@cryptotaxi247 / netdata-1 / commits / b30731b4f

fixed octal parsing in mountinfo, fixes #715

Costa Tsaousis committed Jul 21, 2016 at 00:50 UTC b30731b4f705f9360f5f4d86bd92805accdaad8f
1 file changed +3 -5
src/proc_self_mountinfo.c
+3 -5
@@ -111,7 +111,8 @@ static char *strdup_decoding_octal(const char *string) {
111
112 while(*s) {
113 if(unlikely(*s == '\\')) {
114 - if(likely(isdigit(s[1]) && isdigit(s[2]) && isdigit(s[3]))) {
114 + s++;
115 + if(likely(isdigit(*s) && isdigit(s[1]) && isdigit(s[2]))) {
116 char c = *s++ - '0';
117 c <<= 3;
118 c |= *s++ - '0';
@@ -119,10 +120,7 @@ static char *strdup_decoding_octal(const char *string) {
120 c |= *s++ - '0';
121 *d++ = c;
122 }
122 - else {
123 - *d++ = '_';
124 - s++;
125 - }
123 + else *d++ = '_';
124 }
125 else *d++ = *s++;
126 }