[patch] various bugs and strncpy abuse followup

Rob Landley rob at landley.net
Sun Jun 25 00:37:42 UTC 2006


On Tuesday 06 June 2006 6:34 pm, Erik Hovland wrote:
> After the very helpful feedback and the continual searching for bugs, I
> have expanded my patch associated to various bugs all over busybox.

The most recent tarball I currently have is from the 9th, so I'm going through 
it...

Applied as is:

o zcip.c: applied
o tune2fs.c: applied
o vi.c: applied (and I removed the call to end_line() because all it did was 
get the value to assign into the local variable.)

Fixed up, then applied:

o tar.c: Bernhard's earlier complaint about splitting the strncpy into two 
memcpys wasn't a problem with memcpy, it was that splitting one function into 
two makes things bigger.  (In addition to the two actual function calls 
there's twice as many arguments copied onto the stack.)  Also, we're copying 
known data (a constant string that we're supplying), so even strncpy() is 
kinda silly here, let alone safe_strncpy() or memcpy.  I turned it into a 
strcpy, which dropped an argument (saving 4 bytes, woo!)

Dropped:

o lash.c: already applied, it seems.
o vlock.c: Extra size doesn't seem worth it to me.  (I already commented on 
this.  If these ioctls fail, A) it's obvious to the user, B) what is the 
program supposed to do about it?)

More in a bit...
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list