libutil/unescape: NULL terminate unescaped string
In commit 30fd43d7f3
, unescape was
simplified significantly, but the new version failed to NULL terminate
the resulting string.
This causes bad behavior in various utilities, for example tr:
Broken:
$ echo b2 | tr '\142' '\143'
c3
Fixed:
$ echo b2 | tr '\142' '\143'
c2
This bug breaks libtool's usage of tr, causing gcc to fail to build with
sbase.
This commit is contained in:
parent
72b49a065b
commit
fa0e5d6378
|
@ -52,6 +52,7 @@ unescape(char *s)
|
||||||
eprintf("invalid escape sequence '\\%c'\n", *r);
|
eprintf("invalid escape sequence '\\%c'\n", *r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*w = '\0';
|
||||||
|
|
||||||
return w - s;
|
return w - s;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user