X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Funit-name.c;h=debf2b265333c0bbcb66f2a014275e09afcdf2ec;hp=d0cfca62549cb9af5329d7a84e491de355679903;hb=b363ca6f206258acff8bc0a27dc72a99210011a8;hpb=9fc507041eb524799a0410839e961ec188a78491 diff --git a/src/unit-name.c b/src/unit-name.c index d0cfca625..debf2b265 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;