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. --- sunrpc/svc_simple.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'sunrpc') diff --git a/sunrpc/svc_simple.c b/sunrpc/svc_simple.c index 57bedba163..5ac21ffdbd 100644 --- a/sunrpc/svc_simple.c +++ b/sunrpc/svc_simple.c @@ -84,8 +84,9 @@ registerrpc (u_long prognum, u_long versnum, u_long procnum, if (procnum == NULLPROC) { - (void) __asprintf (&buf, _("can't reassign procedure number %ld\n"), - NULLPROC); + if (__asprintf (&buf, _("can't reassign procedure number %ld\n"), + NULLPROC) < 0) + buf = NULL; goto err_out; } if (transp == 0) @@ -101,8 +102,9 @@ registerrpc (u_long prognum, u_long versnum, u_long procnum, if (!svc_register (transp, (u_long) prognum, (u_long) versnum, universal, IPPROTO_UDP)) { - (void) __asprintf (&buf, _("couldn't register prog %ld vers %ld\n"), - prognum, versnum); + if (__asprintf (&buf, _("couldn't register prog %ld vers %ld\n"), + prognum, versnum) < 0) + buf = NULL; goto err_out; } pl = (struct proglst_ *) malloc (sizeof (struct proglst_)); @@ -121,6 +123,8 @@ registerrpc (u_long prognum, u_long versnum, u_long procnum, return 0; err_out: + if (buf == NULL) + return -1; #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) (void) __fwprintf (stderr, L"%s", buf); @@ -171,16 +175,20 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l) return; if (!INTUSE(svc_sendreply) (transp_l, pl->p_outproc, outdata)) { - (void) __asprintf (&buf, - _("trouble replying to prog %d\n"), - pl->p_prognum); - exit (1); + if (__asprintf (&buf, _("trouble replying to prog %d\n"), + pl->p_prognum) < 0) + buf = NULL; + goto err_out2; } /* free the decoded arguments */ (void) svc_freeargs (transp_l, pl->p_inproc, xdrbuf); return; } - (void) __asprintf (&buf, _("never registered prog %d\n"), prog); + if (__asprintf (&buf, _("never registered prog %d\n"), prog) < 0) + buf = NULL; + err_out2: + if (buf == NULL) + exit (1); #ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); -- cgit v1.2.3