diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2020-06-16 16:14:23 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2020-06-16 16:14:23 +0000 |
commit | 7df3a3af634a75a556ad22591eaf291fc66ca11c (patch) | |
tree | 7b63d6a5b644e022bee822818a248ea6a2796597 /usr.bin/awk/tran.c | |
parent | b45f3bdfd7dcd719668e0a82c2bac43298b8a6e2 (diff) |
Fix strlcpy() size parameter in refldbld(), it was a byte too small.
While here, add proper bounds checking for the partial match case
in refldbld() too and check strlcpy() return values throughout.
Diffstat (limited to 'usr.bin/awk/tran.c')
-rw-r--r-- | usr.bin/awk/tran.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/awk/tran.c b/usr.bin/awk/tran.c index cbc931cec52..5e6aea975d2 100644 --- a/usr.bin/awk/tran.c +++ b/usr.bin/awk/tran.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tran.c,v 1.27 2020/06/10 21:05:50 millert Exp $ */ +/* $OpenBSD: tran.c,v 1.28 2020/06/16 16:14:22 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -524,8 +524,9 @@ char *tostringN(const char *s, size_t n) /* make a copy of string s */ p = malloc(n); if (p == NULL) - FATAL("out of space in tostring on %s", s); - strlcpy(p, s, n); + FATAL("out of space in tostringN %zu", n); + if (strlcpy(p, s, n) >= n) + FATAL("out of space in tostringN on %s", s); return(p); } |