fix negated return value of ns_skiprr, breakage in related functions
authorRich Felker <dalias@aerifal.cx>
Wed, 8 Jul 2015 02:46:45 +0000 (02:46 +0000)
committerRich Felker <dalias@aerifal.cx>
Wed, 8 Jul 2015 02:46:45 +0000 (02:46 +0000)
due to a reversed pointer difference computation, ns_skiprr always
returned a negative value, which functions using it would interpret as
an error.

patch by Yu Lu.

src/network/ns_parse.c

index 3ff33a870ad4c4f5758ba1d0a7dafb2148335edb..d01da47a3d41112ab50c0239b9bff63c9cbe5963 100644 (file)
@@ -95,7 +95,7 @@ int ns_skiprr(const unsigned char *ptr, const unsigned char *eom, ns_sect sectio
                        p += r;
                }
        }
-       return ptr - p;
+       return p - ptr;
 bad:
        errno = EMSGSIZE;
        return -1;