diff options
| author | Chet Ramey <chet.ramey@case.edu> | 2014-02-26 09:36:43 -0500 |
|---|---|---|
| committer | Chet Ramey <chet.ramey@case.edu> | 2014-02-26 09:36:43 -0500 |
| commit | ac50fbac377e32b98d2de396f016ea81e8ee9961 (patch) | |
| tree | f71882366b98fedf1a88a063103219a4935de926 /stringlib.c | |
| parent | 4539d736f1aff232857a854fd2a68df0c98d9f34 (diff) | |
Bash-4.3 distribution sources and documentation
Diffstat (limited to 'stringlib.c')
| -rw-r--r-- | stringlib.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/stringlib.c b/stringlib.c index 0a612ca..9509299 100644 --- a/stringlib.c +++ b/stringlib.c @@ -133,7 +133,7 @@ substring (string, start, end) len = end - start; result = (char *)xmalloc (len + 1); - strncpy (result, string + start, len); + memcpy (result, string + start, len); result[len] = '\0'; return (result); } @@ -158,7 +158,7 @@ strsub (string, pat, rep, global) if (replen) RESIZE_MALLOCED_BUFFER (temp, templen, replen, tempsize, (replen * 2)); - for (r = rep; *r; ) + for (r = rep; *r; ) /* can rep == "" */ temp[templen++] = *r++; i += patlen ? patlen : 1; /* avoid infinite recursion */ |
