Ver Fonte

inet: fix unsafe access to _res.options in res_mkquery()

res_mkquery() takes out __resolv_lock to copy _res.options to function local
_res_options on line 4204, but later unsafely accesses _res.options without a
lock, instead of its local copy _res_options, on line 4221.  Looks like a
period / underscore typo.

Signed-off-by: Vanya Sergeev <vsergeev@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Vanya Sergeev há 11 anos atrás
pai
commit
6e16f1768d
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      libc/inet/resolv.c

+ 1 - 1
libc/inet/resolv.c

@@ -4218,7 +4218,7 @@ int res_mkquery(int op, const char *dname, int class, int type,
 	hp = (HEADER *) buf;
 	hp->id = getpid() & 0xffff;
 	hp->opcode = op;
-	hp->rd = (_res.options & RES_RECURSE) != 0U;
+	hp->rd = (_res_options & RES_RECURSE) != 0U;
 	hp->rcode = NOERROR;
 
 	cp = buf + HFIXEDSZ;