Explorar o código

catch another overlong malloc possibility. found by cypherpunks

Nick Mathewson %!s(int64=15) %!d(string=hai) anos
pai
achega
1f3b442023
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      src/or/routerparse.c

+ 2 - 1
src/or/routerparse.c

@@ -3105,7 +3105,8 @@ get_next_token(memarea_t *area,
 
   obstart = *s; /* Set obstart to start of object spec */
   if (*s+16 >= eol || memchr(*s+11,'\0',eol-*s-16) || /* no short lines, */
-      strcmp_len(eol-5, "-----", 5)) {          /* nuls or invalid endings */
+      strcmp_len(eol-5, "-----", 5) ||           /* nuls or invalid endings */
+      (eol-*s) > MAX_UNPARSED_OBJECT_SIZE) {     /* name too long */
     RET_ERR("Malformed object: bad begin line");
   }
   tok->object_type = STRNDUP(*s+11, eol-*s-16);