Author: avg
Date: Tue Jul 16 07:26:46 2013
New Revision: 253380
URL: http://svnweb.freebsd.org/changeset/base/253380
Log:
  libc: name passed into __setenv is not necessarily NUL-terminated
  
  That's particularly true when __setenv is called from __merge_environ.
  
  MFC after:    4 days

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

Modified: head/lib/libc/stdlib/getenv.c
==============================================================================
--- head/lib/libc/stdlib/getenv.c       Tue Jul 16 06:50:22 2013        
(r253379)
+++ head/lib/libc/stdlib/getenv.c       Tue Jul 16 07:26:46 2013        
(r253380)
@@ -505,7 +505,7 @@ __setenv(const char *name, size_t nameLe
                envVars[envNdx].valueSize = valueLen;
 
                /* Save name of name/value pair. */
-               env = stpcpy(envVars[envNdx].name, name);
+               env = stpncpy(envVars[envNdx].name, name, nameLen);
                if ((envVars[envNdx].name)[nameLen] != '=')
                        env = stpcpy(env, "=");
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to