diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2017-03-22 21:52:22 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2017-03-22 21:52:22 +0000 |
commit | 5c8e56f615804abfd086c68959537a044f32c66d (patch) | |
tree | 617052723387978d60b670715b8b4677eb521ce9 /usr.bin/diff/diff.c | |
parent | 2d23488dac42e567e6d4de9ef1b0211c62f7e3e9 (diff) |
Notes
Diffstat (limited to 'usr.bin/diff/diff.c')
-rw-r--r-- | usr.bin/diff/diff.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c index c5f0632568dc..fd0e76ca3b67 100644 --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -351,9 +351,8 @@ read_excludes_file(char *file) while ((buf = fgetln(fp, &len)) != NULL) { if (buf[len - 1] == '\n') len--; - pattern = xmalloc(len + 1); - memcpy(pattern, buf, len); - pattern[len] = '\0'; + if ((pattern = strndup(buf, len)) == NULL) + err(2, "xstrndup"); push_excludes(pattern); } if (strcmp(file, "-") != 0) |