public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ppluzhnikov at google dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/18043] buffer-overflow (read past the end) in wordexp/parse_dollars/parse_param
Date: Mon, 09 Mar 2015 22:25:00 -0000 [thread overview]
Message-ID: <bug-18043-131-uVIZyypkKt@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-18043-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=18043
Paul Pluzhnikov <ppluzhnikov at google dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution|--- |FIXED
--- Comment #17 from Paul Pluzhnikov <ppluzhnikov at google dot com> ---
The test from comment #13 is invalid. Small repro:
#include <stdio.h>
#include <stdlib.h>
int main() {
setenv("Ca", NULL, 1);
char *p = getenv("Ca");
printf("p: %s\n", p);
return 0;
}
$ gcc t2.c
t2.c: In function ‘main’:
t2.c:5:3: warning: null argument where non-null required (argument 2)
[-Wnonnull]
setenv("Ca", NULL, 1);
^
That is, setenv(..., NULL, ...) is explicitly disallowed.
valgrind ./a.out
==30371== Invalid read of size 1
==30371== at 0x4A70A03: vfprintf
(/build/buildd/eglibc-2.19/stdio-common/vfprintf.c:1661)
==30371== by 0x4A79498: printf
(/build/buildd/eglibc-2.19/stdio-common/printf.c:33)
==30371== by 0x40060C: main (in /tmp/a.out)
==30371== Address 0x4dea2d3 is 0 bytes after a block of size 3 alloc'd
==30371== at 0x40307C4: malloc
(valgrind/coregrind/m_replacemalloc/vg_replace_malloc.c:270)
==30371== by 0x4A60C59: __add_to_environ
(/build/buildd/eglibc-2.19/stdlib/setenv.c:193)
==30371== by 0x40344BF: setenv (valgrind/memcheck/mc_replace_strmem.c:1643)
==30371== by 0x4005E8: main (in /tmp/a.out)
Now, arguably GLIBC could do something smarter and make these equivalent:
setenv("Ca", NULL, 1);
setenv("Ca", "", 1);
But if that NULL should be handled at all, it's a separate bug.
--
You are receiving this mail because:
You are on the CC list for the bug.
>From glibc-bugs-return-27800-listarch-glibc-bugs=sources.redhat.com@sourceware.org Mon Mar 09 22:27:30 2015
Return-Path: <glibc-bugs-return-27800-listarch-glibc-bugs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-glibc-bugs@sources.redhat.com
Received: (qmail 50682 invoked by alias); 9 Mar 2015 22:27:30 -0000
Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <glibc-bugs.sourceware.org>
List-Subscribe: <mailto:glibc-bugs-subscribe@sourceware.org>
List-Post: <mailto:glibc-bugs@sourceware.org>
List-Help: <mailto:glibc-bugs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: glibc-bugs-owner@sourceware.org
Delivered-To: mailing list glibc-bugs@sourceware.org
Received: (qmail 50648 invoked by uid 48); 9 Mar 2015 22:27:27 -0000
From: "konstantin.s.serebryany at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/18043] buffer-overflow (read past the end) in wordexp/parse_dollars/parse_param
Date: Mon, 09 Mar 2015 22:27:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: glibc
X-Bugzilla-Component: libc
X-Bugzilla-Version: 2.21
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: konstantin.s.serebryany at gmail dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: ppluzhnikov at google dot com
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags: security+
X-Bugzilla-Changed-Fields:
Message-ID: <bug-18043-131-Z2oOXM3iVP@http.sourceware.org/bugzilla/>
In-Reply-To: <bug-18043-131@http.sourceware.org/bugzilla/>
References: <bug-18043-131@http.sourceware.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://sourceware.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-03/txt/msg00093.txt.bz2
Content-length: 320
https://sourceware.org/bugzilla/show_bug.cgi?id\x18043
--- Comment #18 from Kostya Serebryany <konstantin.s.serebryany at gmail dot com> ---
The problem here is that setenv("Ca", NULL, 1); is performed by wordexp.
I'll file a separate bug.
--
You are receiving this mail because:
You are on the CC list for the bug.
next prev parent reply other threads:[~2015-03-09 22:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-26 23:10 [Bug libc/18043] New: " konstantin.s.serebryany at gmail dot com
2015-02-28 3:49 ` [Bug libc/18043] " ppluzhnikov at google dot com
2015-03-06 17:14 ` cvs-commit at gcc dot gnu.org
2015-03-06 17:16 ` ppluzhnikov at google dot com
2015-03-09 4:39 ` cvs-commit at gcc dot gnu.org
2015-03-09 6:21 ` konstantin.s.serebryany at gmail dot com
2015-03-09 14:25 ` cvs-commit at gcc dot gnu.org
2015-03-09 14:28 ` ppluzhnikov at google dot com
2015-03-09 16:42 ` konstantin.s.serebryany at gmail dot com
2015-03-09 17:55 ` konstantin.s.serebryany at gmail dot com
2015-03-09 18:20 ` ppluzhnikov at google dot com
2015-03-09 18:39 ` konstantin.s.serebryany at gmail dot com
2015-03-09 18:47 ` konstantin.s.serebryany at gmail dot com
2015-03-09 18:51 ` ppluzhnikov at google dot com
2015-03-09 19:09 ` konstantin.s.serebryany at gmail dot com
2015-03-09 19:10 ` konstantin.s.serebryany at gmail dot com
2015-03-09 19:22 ` ppluzhnikov at google dot com
2015-03-09 19:28 ` konstantin.s.serebryany at gmail dot com
2015-03-09 22:25 ` ppluzhnikov at google dot com [this message]
2015-03-09 22:35 ` konstantin.s.serebryany at gmail dot com
2015-03-09 23:16 ` ppluzhnikov at google dot com
2015-03-11 15:57 ` cvs-commit at gcc dot gnu.org
2015-03-11 16:01 ` ppluzhnikov at google dot com
2015-03-19 14:55 ` fweimer at redhat dot com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-18043-131-uVIZyypkKt@http.sourceware.org/bugzilla/ \
--to=sourceware-bugzilla@sourceware.org \
--cc=glibc-bugs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).