Re: [PATCH V3] Fix buffer size warning for strcpy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Nigel,
It current form it is not working. See my finding below.

On 23.08.2021 17:36, Tkaczyk, Mariusz wrote:

+        int l = strlen(ve->name);
i think that you want to use name instead of ve->name.
length of ve->name is zero after memset.

+        if (l > 16)
+            l = 16;
I think that whole "if" statement can be replaced by:
strnlen(ve->name, sizeof(ve->name))

I did a mistake here.
I want to suggest usage of:
l = strnlen(name, sizeof(ve->name));

+        memcpy(ve->name, name, l);
+    }

Thanks,
Mariusz



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux