Commit Graph

9 Commits

Author SHA1 Message Date
Michael Forney fa0e5d6378 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.
2017-03-24 10:40:32 +01:00
Mattias Andrée 30fd43d7f3 libutil/unescape.c: simplify and add \E
Signed-off-by: Mattias Andrée <maandree@kth.se>
2017-02-06 15:47:01 -08:00
Mattias Andrée 9a903c63de libutil/unescape.c: only print argv0 once on error
Signed-off-by: Mattias Andrée <maandree@kth.se>
2017-02-06 14:13:40 -08:00
FRIGN 6adb9b8ccd Fix compilation error 2016-02-21 08:52:48 +00:00
FRIGN 70adb1252d Do a range check on the resulting octal 2016-02-21 08:52:48 +00:00
FRIGN 41a600e1b8 Allow \0ooo octal escapes
Yeah well, the old topic. POSIX allows \0123 and \123 octals in
different tools, in printf, depending on %b or other things.
We'll just keep it simple and just allow 4 digits. the 0 does not make
a difference anyway.
2016-02-21 08:52:48 +00:00
FRIGN d7a438b2f8 Add \e, \", \' and hex-escapes (\xH[H]) to unescape()
So the users control the program, and the program doesn't
control the users.
2015-02-14 22:55:37 +01:00
FRIGN 38adcf0c08 Fix tabs in libutil/unescape.c 2015-01-29 21:59:27 +01:00
FRIGN b8b9d983c8 Add unescape() to libutil
formerly known as resolveescapes(), it is of central use to numerous
programs.
This drops a lot of LOC.
2015-01-29 21:52:44 +01:00