]> arthur.barton.de Git - netdata.git/commitdiff
fixed octal parsing in mountinfo, fixes #715
authorCosta Tsaousis <costa@tsaousis.gr>
Wed, 20 Jul 2016 21:50:59 +0000 (00:50 +0300)
committerCosta Tsaousis <costa@tsaousis.gr>
Wed, 20 Jul 2016 21:50:59 +0000 (00:50 +0300)
src/proc_self_mountinfo.c

index 303310a0ed323f872b3e525ffefa1cebed1bb932..b5b765a47dc6d240204d2d300a29e93ab67c699c 100644 (file)
@@ -111,7 +111,8 @@ static char *strdup_decoding_octal(const char *string) {
 
        while(*s) {
                if(unlikely(*s == '\\')) {
-                       if(likely(isdigit(s[1]) && isdigit(s[2]) && isdigit(s[3]))) {
+                       s++;
+                       if(likely(isdigit(*s) && isdigit(s[1]) && isdigit(s[2]))) {
                                char c = *s++ - '0';
                                c <<= 3;
                                c |= *s++ - '0';
@@ -119,10 +120,7 @@ static char *strdup_decoding_octal(const char *string) {
                                c |= *s++ - '0';
                                *d++ = c;
                        }
-                       else {
-                               *d++ = '_';
-                               s++;
-                       }
+                       else *d++ = '_';
                }
                else *d++ = *s++;
        }