Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Patches
  • Category Operating System/Drivers
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by nls - 2009-03-31
Last edited by nls - 2009-07-14

FS#10080 - Use strlcpy for string copies and get completely rid of strncpy

This 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 :)

Closed by  nls
2009-07-14 14:04
Reason for closing:  Accepted
Additional comments about closing:  

comitted

nls commented on 2009-04-01 15:11

updated patch, replaced one call to strncpy with memcpy instead of strlcpy in fat.c (thanks to amiconn for noticing)

nls commented on 2009-04-02 21:35

fix a mistake in keybox

ajb commented on 2009-04-21 09:00

Looks good to me. FWIW applying this patch made a whole load of Valgrind warnings I was chasing go away with a m4a file I was debugging. No idea why though :-(

ajb commented on 2009-06-04 14:02

Is anything happening with this patch or has it been rejected?

nls commented on 2009-06-05 09:27

I have been quite busy with exams but i plan to commit this after we release 3.3 which should be in a few weeks.
Any testing is of course very welcome.

nls commented on 2009-06-06 15:48

resynced

nls commented on 2009-07-14 12:40

resync, moved strncpy to the pluginlib to allow imported plugin code to use it and revert the changes to doom

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing