git: c2b119e06bd9 - stable/13 - Correct size parameter to strncmp
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 31 Jan 2026 23:02:48 UTC
The branch stable/13 has been updated by ngie:
URL: https://cgit.FreeBSD.org/src/commit/?id=c2b119e06bd960fbd6e0b69e304cfc7ad559a530
commit c2b119e06bd960fbd6e0b69e304cfc7ad559a530
Author: Alfonso Gregory <gfunni234@gmail.com>
AuthorDate: 2023-05-08 23:08:18 +0000
Commit: Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-01-31 23:02:17 +0000
Correct size parameter to strncmp
The wrong value passed to strncmp meant that only enable and disable were being
accepted. This change corrects the logic so enabled and disabled are also
accepted.
Pull Request: https://github.com/freebsd/freebsd-src/pull/739
MFC after: 1 week
Reviewed by: delphij, ngie
(cherry picked from commit 5a9c724847f9b4e3831aa2c16276cc2ae20a99cc)
---
usr.sbin/mptutil/mpt_volume.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr.sbin/mptutil/mpt_volume.c b/usr.sbin/mptutil/mpt_volume.c
index 73137f647157..71251e591eec 100644
--- a/usr.sbin/mptutil/mpt_volume.c
+++ b/usr.sbin/mptutil/mpt_volume.c
@@ -245,9 +245,9 @@ volume_cache(int ac, char **av)
Settings = volume->VolumeSettings.Settings;
NewSettings = Settings;
- if (strncmp(av[2], "enable", sizeof("enable")) == 0)
+ if (strncmp(av[2], "enable", strlen("enable")) == 0)
NewSettings |= 0x01;
- if (strncmp(av[2], "disable", sizeof("disable")) == 0)
+ else if (strncmp(av[2], "disable", strlen("disable")) == 0)
NewSettings &= ~0x01;
if (NewSettings == Settings) {