瀏覽代碼

fix negated return value of ns_skiprr, breakage in related functions

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.
Rich Felker 9 年之前
父節點
當前提交
e8cbe0bad4
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/network/ns_parse.c

+ 1 - 1
src/network/ns_parse.c

@@ -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;