diff options
Diffstat (limited to 'usr.bin/xargs/strnsubst.c')
-rw-r--r-- | usr.bin/xargs/strnsubst.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/usr.bin/xargs/strnsubst.c b/usr.bin/xargs/strnsubst.c index a06197e..bb8b20e 100644 --- a/usr.bin/xargs/strnsubst.c +++ b/usr.bin/xargs/strnsubst.c @@ -38,6 +38,11 @@ strnsubst(char **str, const char *match, const char *replstr, size_t maxsize) if (s2 == NULL) err(1, "calloc"); + if (match == NULL || replstr == NULL || maxsize == strlen(*str)) { + strlcpy(s2, s1, maxsize); + goto done; + } + for (;;) { char *this; |