From: Ulrich Drepper Date: Tue, 1 Jun 2004 22:15:24 +0000 (+0000) Subject: (__argp_error, __argp_failure): Check result of __asprintf call and don't use string... X-Git-Tag: cvs/fedora-base~421 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ddfc0595a4444ee13aec46e118b3b3463012267;p=platform%2Fupstream%2Fglibc.git (__argp_error, __argp_failure): Check result of __asprintf call and don't use string if it failed. --- diff --git a/argp/argp-help.c b/argp/argp-help.c index 1921e52..6701870 100644 --- a/argp/argp-help.c +++ b/argp/argp-help.c @@ -1768,7 +1768,8 @@ __argp_error (const struct argp_state *state, const char *fmt, ...) { char *buf; - __asprintf (&buf, fmt, ap); + if (__asprintf (&buf, fmt, ap) < 0) + buf = NULL; __fwprintf (stream, L"%s: %s\n", state ? state->name : __argp_short_program_name (), @@ -1846,7 +1847,8 @@ __argp_failure (const struct argp_state *state, int status, int errnum, { char *buf; - __asprintf (&buf, fmt, ap); + if (__asprintf (&buf, fmt, ap) < 0) + buf = NULL; __fwprintf (stream, L": %s", buf);