From 322861e8b62dbca030a66f9ab37e6688b223c65f Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 1 Jun 2004 22:18:24 +0000 Subject: Update. 2004-05-07 Dmitry V. Levin * argp/argp-help.c (__argp_error, __argp_failure): Check result of __asprintf call and don't use string if it failed. * stdio-common/psignal.c (psignal): Likewise. * locale/programs/localedef.c (more_help): Likewise. * resolv/res_hconf.c (arg_service_list, arg_trimdomain_list, arg_bool, parse_line): Check result of __asprintf calls and don't use string if they failed. * sunrpc/svc_simple.c (registerrpc, universal): Likewise. * elf/ldconfig.c (parse_conf_include): Check result of __asprintf call and exit if it failed. --- resolv/res_hconf.c | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'resolv') diff --git a/resolv/res_hconf.c b/resolv/res_hconf.c index 59f186e246..91cd300482 100644 --- a/resolv/res_hconf.c +++ b/resolv/res_hconf.c @@ -145,8 +145,10 @@ arg_service_list (const char *fname, int line_num, const char *args, { char *buf; - __asprintf (&buf, _("%s: line %d: expected service, found `%s'\n"), - fname, line_num, start); + if (__asprintf (&buf, + _("%s: line %d: expected service, found `%s'\n"), + fname, line_num, start) < 0) + return 0; #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) @@ -162,9 +164,10 @@ arg_service_list (const char *fname, int line_num, const char *args, { char *buf; - __asprintf (&buf, - _("%s: line %d: cannot specify more than %d services"), - fname, line_num, SERVICE_MAX); + if (__asprintf (&buf, _("\ +%s: line %d: cannot specify more than %d services"), + fname, line_num, SERVICE_MAX) < 0) + return 0; #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) @@ -189,9 +192,10 @@ arg_service_list (const char *fname, int line_num, const char *args, { char *buf; - __asprintf (&buf, _("\ + if (__asprintf (&buf, _("\ %s: line %d: list delimiter not followed by keyword"), - fname, line_num); + fname, line_num) < 0) + return 0; #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) @@ -229,9 +233,10 @@ arg_trimdomain_list (const char *fname, int line_num, const char *args, { char *buf; - __asprintf (&buf, _("\ + if (__asprintf (&buf, _("\ %s: line %d: cannot specify more than %d trim domains"), - fname, line_num, TRIMDOMAINS_MAX); + fname, line_num, TRIMDOMAINS_MAX) < 0) + return 0; #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) @@ -254,9 +259,10 @@ arg_trimdomain_list (const char *fname, int line_num, const char *args, { char *buf; - __asprintf (&buf, _("\ + if (__asprintf (&buf, _("\ %s: line %d: list delimiter not followed by domain"), - fname, line_num); + fname, line_num) < 0) + return 0; #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) @@ -316,9 +322,10 @@ arg_bool (const char *fname, int line_num, const char *args, unsigned flag) { char *buf; - __asprintf (&buf, - _("%s: line %d: expected `on' or `off', found `%s'\n"), - fname, line_num, args); + if (__asprintf (&buf, + _("%s: line %d: expected `on' or `off', found `%s'\n"), + fname, line_num, args) < 0) + return 0; #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) @@ -364,8 +371,9 @@ parse_line (const char *fname, int line_num, const char *str) { char *buf; - __asprintf (&buf, _("%s: line %d: bad command `%s'\n"), - fname, line_num, start); + if (__asprintf (&buf, _("%s: line %d: bad command `%s'\n"), + fname, line_num, start) < 0) + return; #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) @@ -392,9 +400,10 @@ parse_line (const char *fname, int line_num, const char *str) { char *buf; - __asprintf (&buf, - _("%s: line %d: ignoring trailing garbage `%s'\n"), - fname, line_num, str); + if (__asprintf (&buf, + _("%s: line %d: ignoring trailing garbage `%s'\n"), + fname, line_num, str) < 0) + break; #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) -- cgit 1.4.1