man3/strncpy.3.html

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

 



http://man7.org/linux/man-pages/man3/strncpy.3.html
I see:
           strncpy(buf, str, buflen - 1);
           if (buflen > 0)
               buf[buflen - 1]= '\0';

I expected:
           if (buflen > 0)
           {
               strncpy(buf, str, buflen - 1);
               buf[buflen - 1]= '\0';
           }
(I expected `buflen` to be checked against `0` BEFORE calling
`strncpy()`, not AFTER)

Robin Kuzmin
kuzmin.robin@xxxxxxxxx



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux