diff options
author | 2006-04-29 05:31:28 +0000 | |
---|---|---|
committer | 2006-04-29 05:31:28 +0000 | |
commit | 6b99bb86bbfee63d44b56f28a81825af72a4b563 (patch) | |
tree | a7f5117ed1cefc9aa5c5a2997c09e65cea814a50 /usr.bin/rcs/rcsutil.c | |
parent | Clarify man pages to match -t behavior and pretty up usage strings. (diff) | |
download | wireguard-openbsd-6b99bb86bbfee63d44b56f28a81825af72a4b563.tar.xz wireguard-openbsd-6b99bb86bbfee63d44b56f28a81825af72a4b563.zip |
Check return values for all strlcpy, and strlcat calls.
OK xsa@ and probably others.
Diffstat (limited to 'usr.bin/rcs/rcsutil.c')
-rw-r--r-- | usr.bin/rcs/rcsutil.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/rcs/rcsutil.c b/usr.bin/rcs/rcsutil.c index 31119174e33..c1ce031ec7c 100644 --- a/usr.bin/rcs/rcsutil.c +++ b/usr.bin/rcs/rcsutil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsutil.c,v 1.7 2006/04/27 07:59:33 xsa Exp $ */ +/* $OpenBSD: rcsutil.c,v 1.8 2006/04/29 05:31:28 ray Exp $ */ /* * Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> @@ -197,7 +197,8 @@ rcs_choosefile(const char *filename, char *out, size_t len) */ if (strcmp(rcs_suffixes, "") == 0) { fd = open(rcspath, O_RDONLY); - strlcpy(out, rcspath, len); + if (strlcpy(out, rcspath, len) >= len) + errx(1, "rcs_choosefile: truncation"); return (fd); } @@ -263,7 +264,8 @@ rcs_choosefile(const char *filename, char *out, size_t len) xfree(suffixes); fd = open(rcspath, O_RDONLY); - strlcpy(out, rcspath, len); + if (strlcpy(out, rcspath, len) >= len) + errx(1, "rcs_choosefile: truncation"); return (fd); } |