On 15/02/17 00:09, Tobin C. Harding wrote: > Greybus currently uses strncpy() coupled with a check for '\0' on the > last byte of various buffers. strncpy() is passed size parameter equal > to the size of the buffer in all instances. If the source string is > larger than the destination buffer the check catches this and, after > logging the error, returns an error value. In one instance the > immediate return is not required. Using strncpy() with the manual check > adds code that could be removed by the use of strlcpy(), although truncation > then needs to be checked. > > Replace calls to strncpy() with calls to strlcpy(). Replace null > termination checks with checks for truncated string. Add log message > if string is truncated but do not return an error code. The strlcpy() replace should be one patch. The not returning on truncation should be a separate patch. Personally I don't think the flow should change re: returning errors on string truncation but, either way you should split it up. --- bod _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel