Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Feb 2022 16:59:49 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 261679] libc/locale/xlocale.c: potential NULL pointer dereference in alloc_locale()
Message-ID:  <bug-261679-227@https.bugs.freebsd.org/bugzilla/>

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

            Bug ID: 261679
           Summary: libc/locale/xlocale.c: potential NULL pointer
                    dereference in alloc_locale()
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: phil.stone@gmx.com

/usr/src/lib/libc/locale/xlocale.c, line 191

static locale_t
alloc_locale(void)
{
        locale_t new =3D calloc(sizeof(struct _xlocale), 1);

        new->header.destructor =3D destruct_locale;
        new->monetary_locale_changed =3D 1;
        new->numeric_locale_changed =3D 1;
        return (new);
}

calloc() return value is not tested. Variable new is always dereferenced, e=
ven
in the (unexpected) case where it is NULL.

--=20
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-261679-227>