summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authoruqs <uqs@FreeBSD.org>2010-05-24 06:33:14 +0000
committeruqs <uqs@FreeBSD.org>2010-05-24 06:33:14 +0000
commit60e8c402f34a3b6cd2d0dc500b0239ebf10dfd74 (patch)
treea5d9ac407f9ddf601077d1cd210a73a061c787b6 /bin
parente5ed83efa956ac1ea34b61a2b7e35dd90cc0467b (diff)
downloadFreeBSD-src-60e8c402f34a3b6cd2d0dc500b0239ebf10dfd74.zip
FreeBSD-src-60e8c402f34a3b6cd2d0dc500b0239ebf10dfd74.tar.gz
Fix back references in substitute command for pax(1)
pax(1) was trying to copy the back-referenced data from the match pattern, not the matched data. PR: bin/118132 Obtained from: Debian bug #451361 Reviewed by: jilles MFC after: 3 weeks
Diffstat (limited to 'bin')
-rw-r--r--bin/pax/pat_rep.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/pax/pat_rep.c b/bin/pax/pat_rep.c
index 83e07dd..62539a2 100644
--- a/bin/pax/pat_rep.c
+++ b/bin/pax/pat_rep.c
@@ -76,7 +76,7 @@ static char * range_match(char *, int);
#ifdef NET2_REGEX
static int resub(regexp *, char *, char *, char *);
#else
-static int resub(regex_t *, regmatch_t *, char *, char *, char *);
+static int resub(regex_t *, regmatch_t *, char *, char *, char *, char *);
#endif
/*
@@ -929,7 +929,7 @@ rep_name(char *name, int *nlen, int prnt)
# ifdef NET2_REGEX
if ((res = resub(pt->rcmp,pt->nstr,outpt,endpt)) < 0) {
# else
- if ((res = resub(&(pt->rcmp),pm,pt->nstr,outpt,endpt))
+ if ((res = resub(&(pt->rcmp),pm,inpt,pt->nstr,outpt,endpt))
< 0) {
# endif
if (prnt)
@@ -1071,7 +1071,7 @@ resub(regexp *prog, char *src, char *dest, char *destend)
*/
static int
-resub(regex_t *rp, regmatch_t *pm, char *src, char *dest,
+resub(regex_t *rp, regmatch_t *pm, char *orig, char *src, char *dest,
char *destend)
{
char *spt;
@@ -1121,7 +1121,7 @@ resub(regex_t *rp, regmatch_t *pm, char *src, char *dest,
*/
if (len > (destend - dpt))
len = destend - dpt;
- if (l_strncpy(dpt, src + pmpt->rm_so, len) != len)
+ if (l_strncpy(dpt, orig + pmpt->rm_so, len) != len)
return(-1);
dpt += len;
}
OpenPOWER on IntegriCloud