mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: take 8 and 9 as hex digits in an \x escape
An f or w entry with \x39 in the argument writes the byte 3 followed
by a 9, where it should write a 9:
f /tmp/file - - - - \x39
write_hex() only takes the digits 0 to 7, as for an octal escape.
Take all hex digits.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
3 files changed
+12
-3
No files matched your search
+2
-3
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "config.h" /* Generated by configure script */
|
||||
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <endian.h>
|
||||
#include <fcntl.h>
|
||||
@@ -190,9 +191,7 @@ static char *write_hex(FILE *fp, char *p)
|
||||
for (i = 0; p[i] && len < 2; i++) {
|
||||
char c = p[i];
|
||||
|
||||
if ((c >= '0' && c <= '7') ||
|
||||
(c >= 'a' && c <= 'f') ||
|
||||
(c >= 'A' && c <= 'F'))
|
||||
if (isxdigit((unsigned char)c))
|
||||
num[len++] = c;
|
||||
else
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user