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
This commit is contained in:
Rose 2023-05-08 19:08:18 -04:00 committed by Enji Cooper
parent cef2565587
commit 5a9c724847

View file

@ -246,9 +246,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) {