From 0ceb5d63d6734796c9e04acfcb557807090f6f04 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 1 Jan 2008 05:29:13 +0200 Subject: [PATCH] Do not use strdup for execvp arguments Closes: #379027 --- ChangeLog | 5 +++++ debian/changelog | 1 + src/archives.c | 19 +++++++++++-------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e06afac..3d74ecf0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-01-01 Guillem Jover + + * src/archives.c (archivefiles): Remove pointless strdup for execvp + arguments. + 2008-01-01 Ian Zimmerman * scripts/install-info.pl: Ignore wrapped lines when matching diff --git a/debian/changelog b/debian/changelog index 141ceaf4..38390005 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,6 +21,7 @@ dpkg (1.14.15) UNRELEASED; urgency=low * Ignore wrapped lines in install-info when matching section titles. Closes: #214684 Thanks to Andreas Metzler and Ian Zimmerman. + * Do not use strdup for execvp arguments. Closes: #379027 [ Updated dpkg translations ] * Norwegian Bokmål (Hans Fredrik Nordhaug). Closes: #457918 diff --git a/src/archives.c b/src/archives.c index df21d277..64a104ef 100644 --- a/src/archives.c +++ b/src/archives.c @@ -1097,7 +1097,7 @@ void archivefiles(const char *const *argv) { m_dup2(pi[1],1); close(pi[0]); close(pi[1]); for (i=0, ap=argv; *ap; ap++, i++); narglist= m_malloc(sizeof(char*)*(i+15)); - narglist[0]= strdup(FIND); + narglist[0] = FIND; for (i=1, ap=argv; *ap; ap++, i++) { if (strchr(FIND_EXPRSTARTCHARS,(*ap)[0])) { char *a; @@ -1106,15 +1106,18 @@ void archivefiles(const char *const *argv) { strcat(a,*ap); narglist[i]= a; } else { - narglist[i]= strdup(*ap); + narglist[i] = (char *)*ap; } } - narglist[i++]= strdup("-follow"); /* When editing these, make sure that */ - narglist[i++]= strdup("-name"); /* arglist is mallocd big enough, above. */ - narglist[i++]= strdup(ARCHIVE_FILENAME_PATTERN); - narglist[i++]= strdup("-type"); - narglist[i++]= strdup("f"); - narglist[i++]= strdup("-print0"); + /* When editing these, make sure that arglist is malloced big enough, + * above. + */ + narglist[i++] = "-follow"; + narglist[i++] = "-name"; + narglist[i++] = ARCHIVE_FILENAME_PATTERN; + narglist[i++] = "-type"; + narglist[i++] = "f"; + narglist[i++] = "-print0"; narglist[i++]= 0; execvp(FIND, narglist); ohshite(_("failed to exec find for --recursive")); -- 2.39.5