public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "konstantin.s.serebryany at gmail dot com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug libc/18096] null deref in wordexp/parse_dollars/parse_arith Date: Mon, 09 Mar 2015 16:24:00 -0000 [thread overview] Message-ID: <bug-18096-131-BOgtpPtTSN@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-18096-131@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=18096 --- Comment #1 from Kostya Serebryany <konstantin.s.serebryany at gmail dot com> --- Another similar looking, but on different line: #include <wordexp.h> #include <string.h> int main() { char *p = strdup("$(())"); wordexp_t w; wordexp(p, &w, 0); } #0 0x7fc1c04a26f6 in parse_arith /build/buildd/eglibc-2.19/posix/wordexp.c:736 #1 0x7fc1c04a0123 in parse_dollars /build/buildd/eglibc-2.19/posix/wordexp.c:2096 #2 0x7fc1c04a2feb in wordexp /build/buildd/eglibc-2.19/posix/wordexp.c:2348 The following stops the bug for me: --- a/posix/wordexp.c +++ b/posix/wordexp.c @@ -736,7 +736,7 @@ parse_arith (char **word, size_t *word_length, size_t *max_length, ++(*offset); /* Go - evaluate. */ - if (*expr && eval_expr (expr, &numresult) != 0) + if (expr && *expr && eval_expr (expr, &numresult) != 0) { free (expr); return WRDE_SYNTAX; @@ -774,7 +774,7 @@ parse_arith (char **word, size_t *word_length, size_t *max_length, long int numresult = 0; /* Go - evaluate. */ - if (*expr && eval_expr (expr, &numresult) != 0) + if (expr && *expr && eval_expr (expr, &numresult) != 0) { free (expr); return WRDE_SYNTAX; -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2015-03-09 16:24 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-03-09 15:31 [Bug libc/18096] New: " konstantin.s.serebryany at gmail dot com 2015-03-09 16:24 ` konstantin.s.serebryany at gmail dot com [this message] 2015-03-09 18:56 ` [Bug libc/18096] " konstantin.s.serebryany at gmail dot com 2015-03-11 6:44 ` carlos at redhat dot com 2015-03-11 8:57 ` schwab@linux-m68k.org 2015-03-11 13:45 ` carlos at redhat dot com 2015-03-11 14:03 ` schwab@linux-m68k.org 2015-03-11 16:12 ` konstantin.s.serebryany at gmail dot com 2015-03-11 16:20 ` carlos at redhat dot com 2015-03-11 16:34 ` carlos at redhat dot com 2015-03-11 22:23 ` bugdal at aerifal dot cx 2015-03-19 15:09 ` fweimer at redhat dot com 2015-07-12 7:44 ` neleai at seznam dot cz 2015-07-21 10:10 ` fweimer at redhat dot com 2015-08-27 22:26 ` [Bug glob/18096] " jsm28 at gcc dot gnu.org 2023-03-28 13:59 ` adhemerval.zanella at linaro dot org
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-18096-131-BOgtpPtTSN@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: linkBe 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).