]> granicus.if.org Git - strace/commit
Fix a bug in dumpstr (no null termination). Essentially rewrote dumpstr
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 22 Feb 2013 13:47:39 +0000 (14:47 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 22 Feb 2013 13:47:39 +0000 (14:47 +0100)
commit763258071ccafd3499979348a5461670bbe20bd8
tree5b0be44d50c3b6bea4dd85e351db45904245a3ce
parent9cbc15b7e72b2f108b886f89778ae606c7b6a526
Fix a bug in dumpstr (no null termination). Essentially rewrote dumpstr

This is a 14 year old bug (!).

It wasn't biting us merely because outstr[80] was static, thus ended up
in bss and whatever was after it "accidentally" provided the NUL byte.
When dumpstr was changed to use on-stack buffer, the bug reared its ugly head.

This is a rewrite which is smaller and should be significantly faster
for _long_ strings.

   text    data     bss     dec     hex filename
 244627     680   10860  256167   3e8a7 strace.t9/strace
 244563     680   10860  256103   3e867 strace.ta/strace

* util.c (dumpstr): Rewrite to be faster and smaller.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
util.c