Date: Wed, 24 Jul 2013 13:07:30 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r253610 - stable/9/lib/libc/stdlib Message-ID: <201307241307.r6OD7UbM064226@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Wed Jul 24 13:07:29 2013 New Revision: 253610 URL: http://svnweb.freebsd.org/changeset/base/253610 Log: MFC r253380,253413: name passed into __setenv is not necessarily NUL-terminated Approved by: re (kib) Modified: stable/9/lib/libc/stdlib/getenv.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/stdlib/getenv.c ============================================================================== --- stable/9/lib/libc/stdlib/getenv.c Wed Jul 24 11:32:58 2013 (r253609) +++ stable/9/lib/libc/stdlib/getenv.c Wed Jul 24 13:07:29 2013 (r253610) @@ -505,9 +505,8 @@ __setenv(const char *name, size_t nameLe envVars[envNdx].valueSize = valueLen; /* Save name of name/value pair. */ - env = stpcpy(envVars[envNdx].name, name); - if ((envVars[envNdx].name)[nameLen] != '=') - env = stpcpy(env, "="); + env = stpncpy(envVars[envNdx].name, name, nameLen); + *env++ = '='; } else env = envVars[envNdx].value;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307241307.r6OD7UbM064226>