svn commit: r253413 - head/lib/libc/stdlib

Andriy Gapon avg at FreeBSD.org
Wed Jul 17 08:45:27 UTC 2013


Author: avg
Date: Wed Jul 17 08:45:27 2013
New Revision: 253413
URL: http://svnweb.freebsd.org/changeset/base/253413

Log:
  [fix to r253380] __setenv: be explicit about placing '=' after name
  
  This should a regression introduced in r253380 if malloc'ed memory
  happens to have '=' at the right place.
  
  Reported by:	ache
  Pointyhat to:	me (avg)
  MFC after:	1 day
  X-MFC with:	r253380

Modified:
  head/lib/libc/stdlib/getenv.c

Modified: head/lib/libc/stdlib/getenv.c
==============================================================================
--- head/lib/libc/stdlib/getenv.c	Wed Jul 17 07:17:07 2013	(r253412)
+++ head/lib/libc/stdlib/getenv.c	Wed Jul 17 08:45:27 2013	(r253413)
@@ -506,8 +506,7 @@ __setenv(const char *name, size_t nameLe
 
 		/* Save name of name/value pair. */
 		env = stpncpy(envVars[envNdx].name, name, nameLen);
-		if ((envVars[envNdx].name)[nameLen] != '=')
-			env = stpcpy(env, "=");
+		*env++ = '=';
 	}
 	else
 		env = envVars[envNdx].value;


More information about the svn-src-all mailing list