FS#10080 - Use strlcpy for string copies and get completely rid of strncpy
Attached to Project:
Rockbox
Opened by Nils Wallménius (nls) - Tuesday, 31 March 2009, 16:58 GMT
Last edited by Nils Wallménius (nls) - Tuesday, 14 July 2009, 14:04 GMT
Opened by Nils Wallménius (nls) - Tuesday, 31 March 2009, 16:58 GMT
Last edited by Nils Wallménius (nls) - Tuesday, 14 July 2009, 14:04 GMT
|
DetailsThis patch removes strncpy from rockbox and introduces the strlcpy function instead. Most uses of strncpy have been changed to use strlcpy and a few to use memcpy.
the differences between strlcpy and strncpy is that strlcpy guarantees null termination of the copied string while strncpy does not and that strlcpy does not zero pad the rest of the buffer. This means that copying short strings into large buffers should be a lot faster and that there is no need to guard for the case that the string is truncated and strncpy would not have null terminated it. This patch touches a lot of files and while i have gone over the changes several times and tested on both gigabeast and c200 and sims there are some things i can't or didn't test so i would appreciate review and testing :) |
This task depends upon
Closed by Nils Wallménius (nls)
Tuesday, 14 July 2009, 14:04 GMT
Reason for closing: Accepted
Additional comments about closing: comitted
Tuesday, 14 July 2009, 14:04 GMT
Reason for closing: Accepted
Additional comments about closing: comitted
Any testing is of course very welcome.