[hackers] [sbase] Do a range check on the resulting octal || FRIGN

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

commit 70adb1252dd154bd6517af49e916b8f2d4deeac9
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Sat Feb 20 21:50:21 2016 +0100
Commit: sin <sin_AT_2f30.org>
CommitDate: Sun Feb 21 08:52:48 2016 +0000

    Do a range check on the resulting octal

diff --git a/libutil/unescape.c b/libutil/unescape.c
index 627c2a2..be18d1f 100644
--- a/libutil/unescape.c
+++ b/libutil/unescape.c
_AT_@ -62,7 +62,7 @@ unescape(char *s)
                                 q += (s[m] - '0') * factor;
                                 factor *= 8;
                         }
- s[i] = q;
+ s[i] = (q > 255) 255 : q;
                 }
 
                 for (m = i + 1; m <= len - off; m++)
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:19 CET