about summary refs log tree commit diff
path: root/resolv/res_hconf.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-06-01 22:18:24 +0000
committerUlrich Drepper <drepper@redhat.com>2004-06-01 22:18:24 +0000
commit322861e8b62dbca030a66f9ab37e6688b223c65f (patch)
tree4ee930f44d4484f577cae54b3845e91ae6517d57 /resolv/res_hconf.c
parent9ddfc0595a4444ee13aec46e118b3b3463012267 (diff)
downloadglibc-322861e8b62dbca030a66f9ab37e6688b223c65f.tar.gz
glibc-322861e8b62dbca030a66f9ab37e6688b223c65f.tar.xz
glibc-322861e8b62dbca030a66f9ab37e6688b223c65f.zip
Update.
2004-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	* 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.
Diffstat (limited to 'resolv/res_hconf.c')
-rw-r--r--resolv/res_hconf.c47
1 files changed, 28 insertions, 19 deletions
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)