Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 06 Aug 2015 19:36:45 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 202142] Uninitialized variable usage in error path in _dns_getaddrinfo()
Message-ID:  <bug-202142-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202142

            Bug ID: 202142
           Summary: Uninitialized variable usage in error path in
                    _dns_getaddrinfo()
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: misc
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: seanb@cosemica.com

The calls to RES_SET_H_ERRNO() macro on error paths wind up
dereferencing an uninitialized res:

Index: net/getaddrinfo.c
===================================================================
--- net/getaddrinfo.c    (revision 286381)
+++ net/getaddrinfo.c    (working copy)
@@ -2154,6 +2154,8 @@
     memset(&sentinel, 0, sizeof(sentinel));
     cur = &sentinel;

+    res = __res_state();
+
     buf = malloc(sizeof(*buf));
     if (!buf) {
         RES_SET_H_ERRNO(res, NETDB_INTERNAL);
@@ -2200,7 +2202,6 @@
         return NS_UNAVAIL;
     }

-    res = __res_state();
     if ((res->options & RES_INIT) == 0 && res_ninit(res) == -1) {
         RES_SET_H_ERRNO(res, NETDB_INTERNAL);
         free(buf);

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-202142-8>