[Bug network/22095] New: Name server address allocation memory leak in resolv.conf parsing after OOM

fweimer at redhat dot com sourceware-bugzilla@sourceware.org
Wed Sep 6 13:19:00 GMT 2017


https://sourceware.org/bugzilla/show_bug.cgi?id=22095

            Bug ID: 22095
           Summary: Name server address allocation memory leak in
                    resolv.conf parsing after OOM
           Product: glibc
           Version: 2.26
            Status: NEW
          Severity: normal
          Priority: P2
         Component: network
          Assignee: fweimer at redhat dot com
          Reporter: fweimer at redhat dot com
  Target Milestone: ---
             Flags: security-

This code in res_vinit_1 allocates an address, but if it cannot be placed into
the array due to an out-of-memory condition, it will leak:

              if ((*cp != '\0') && (*cp != '\n') && __inet_aton (cp, &a))
                {
                  sa = allocate_address_v4 (a, NAMESERVER_PORT);
                  if (sa == NULL)
                    return false;
                }
…
              if (sa != NULL)
                {
                  const struct sockaddr **p = nameserver_list_emplace
                    (&parser->nameserver_list);
                  if (p != NULL)
                    *p = sa;
                  else
                    {
                      free (sa);
                      return false;
                    }
                }

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list