[hackers] [sbase] Allow \0ooo octal escapes || FRIGN

From: <git_AT_suckless.org>
Date: Sun, 21 Feb 2016 09:52:55 +0100 (CET)

commit 41a600e1b8856a6710524f56470b592700d1899f
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Sat Feb 20 21:40:11 2016 +0100
Commit: sin <sin_AT_2f30.org>
CommitDate: Sun Feb 21 08:52:48 2016 +0000

    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.

diff --git a/libutil/unescape.c b/libutil/unescape.c
index bf29230..627c2a2 100644
--- a/libutil/unescape.c
+++ b/libutil/unescape.c
_AT_@ -51,8 +51,8 @@ unescape(char *s)
                 case '\0':
                         eprintf("%s: null escape sequence\n", argv0);
                 default:
- /* "\O[OO]" octal escape */
- for (m = i + 1; m < i + 1 + 3 && m < len; m++)
+ /* "\O[OOO]" octal escape */
+ for (m = i + 1; m < i + 1 + 4 && m < len; m++)
                                 if (s[m] < '0' || s[m] > '7')
                                         break;
                         if (m == i + 1)
Received on Sun Feb 21 2016 - 09:52:55 CET

This archive was generated by hypermail 2.3.0 : Sun Feb 21 2016 - 10:00:14 CET