Date: Mon, 29 Apr 2013 21:12:26 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250075 - head/libexec/rtld-elf Message-ID: <201304292112.r3TLCQQh091167@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Mon Apr 29 21:12:25 2013 New Revision: 250075 URL: http://svnweb.freebsd.org/changeset/base/250075 Log: Properly terminate the result string for intermediate results, to allow the final strcpy() to start at the intended place. Reported and tested by: pgj Pointy hat to: kib MFC after: 3 days Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Mon Apr 29 21:12:18 2013 (r250074) +++ head/libexec/rtld-elf/rtld.c Mon Apr 29 21:12:25 2013 (r250075) @@ -784,7 +784,7 @@ origin_subst_one(char *real, const char /* * Now, execute the substitution loop. */ - for (p = real, resp = res;;) { + for (p = real, resp = res, *resp = '\0';;) { p1 = strstr(p, kw); if (p1 != NULL) { /* Copy the prefix before keyword. */ @@ -793,6 +793,7 @@ origin_subst_one(char *real, const char /* Keyword replacement. */ memcpy(resp, subst, subst_len); resp += subst_len; + *resp = '\0'; p = p1 + kw_len; } else break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304292112.r3TLCQQh091167>