summaryrefslogtreecommitdiff
path: root/usr.bin/rcs/xmalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/rcs/xmalloc.c')
-rw-r--r--usr.bin/rcs/xmalloc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/rcs/xmalloc.c b/usr.bin/rcs/xmalloc.c
index 3d90ca09170..370ab0f99e7 100644
--- a/usr.bin/rcs/xmalloc.c
+++ b/usr.bin/rcs/xmalloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xmalloc.c,v 1.1 2006/04/26 02:55:13 joris Exp $ */
+/* $OpenBSD: xmalloc.c,v 1.2 2006/04/29 05:31:28 ray Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -84,7 +84,8 @@ xstrdup(const char *str)
len = strlen(str) + 1;
cp = xmalloc(len);
- strlcpy(cp, str, len);
+ if (strlcpy(cp, str, len) >= len)
+ errx(1, "xstrdup: string truncated");
return cp;
}