From: "Ondřej Bílka" <neleai@seznam.cz>
To: libc-alpha@sourceware.org
Subject: [PATCH][BZ #18096] Handle null dereferences in wordexp
Date: Sun, 12 Jul 2015 07:49:00 -0000 [thread overview]
Message-ID: <20150712074917.GA6245@domone> (raw)
Hi,
Kostya, and Carlos wrote this patch on bugzilla but I didn't seen it on
libc-alpha.
These look good for me. Carlos, could you commit it?
diff --git a/posix/wordexp.c b/posix/wordexp.c
index e711d43..d3f3764 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -740,7 +740,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;
@@ -778,7 +778,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;
@@ -1843,11 +1843,11 @@ envsubst:
if (!colon_seen && value)
/* Substitute NULL */
;
- else
+ else if (flags & WRDE_SHOWERR)
{
const char *str = pattern;
- if (str[0] == '\0')
+ if (str && str[0] == '\0')
str = _("parameter null or not set");
__fxprintf (NULL, "%s: %s\n", env, str);
next reply other threads:[~2015-07-12 7:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-12 7:49 Ondřej Bílka [this message]
2015-07-28 3:22 ` Mike Frysinger
2015-07-28 6:33 ` Ondřej Bílka
2015-08-12 14:41 ` [ping][PATCH][BZ " Ondřej Bílka
2015-08-19 9:23 ` [ping^2][PATCH][BZ " Ondřej Bílka
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=20150712074917.GA6245@domone \
--to=neleai@seznam.cz \
--cc=libc-alpha@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).