summaryrefslogtreecommitdiff
path: root/src/unit-name.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2010-10-17 00:11:23 +0200
committerLennart Poettering <lennart@poettering.net>2010-10-21 14:04:10 +0200
commit95e501f8ab28e1645453219523c0263754db3f68 (patch)
treee18925b774f0efe08db4f3b0dea6b073f5f68344 /src/unit-name.c
parentabe35cc2b7921891cc56cd8d402e8f7d1ef48d39 (diff)
unit-name: Fix unescaping
Invalid characters in unit names are escaped as \xFF. However, when unescaping we were looking for \FF.
Diffstat (limited to 'src/unit-name.c')
-rw-r--r--src/unit-name.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/unit-name.c b/src/unit-name.c
index d0cfca6254..debf2b2653 100644
--- a/src/unit-name.c
+++ b/src/unit-name.c
@@ -272,13 +272,13 @@ char *unit_name_unescape(const char *f) {
else if (*f == '\\') {
int a, b;
- if ((a = unhexchar(f[1])) < 0 ||
- (b = unhexchar(f[2])) < 0) {
- /* Invalid escape code, let's take it literal then */
+ if (f[1] != 'x' || (a = unhexchar(f[2])) < 0 ||
+ (b = unhexchar(f[3])) < 0) {
+ /* Invalid escape code, let's take it literal then */
*(t++) = '\\';
} else {
*(t++) = (char) ((a << 4) | b);
- f += 2;
+ f += 3;
}
} else
*(t++) = *f;