Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/net Replace strcpy with strlcpy and bounds check.
details: https://anonhg.NetBSD.org/src/rev/e0c06af8b8c3
branches: trunk
changeset: 503786:e0c06af8b8c3
user: sommerfeld <sommerfeld%NetBSD.org@localhost>
date: Tue Feb 13 15:41:18 2001 +0000
description:
Replace strcpy with strlcpy and bounds check.
>From mheffner%vt.edu@localhost via freebsd-audit%freebsd.org@localhost via hesiod%mit.edu@localhost
diffstat:
lib/libc/net/hesiod.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r 4821ca34aa33 -r e0c06af8b8c3 lib/libc/net/hesiod.c
--- a/lib/libc/net/hesiod.c Tue Feb 13 14:35:21 2001 +0000
+++ b/lib/libc/net/hesiod.c Tue Feb 13 15:41:18 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hesiod.c,v 1.15 2000/10/31 12:47:21 lukem Exp $ */
+/* $NetBSD: hesiod.c,v 1.16 2001/02/13 15:41:18 sommerfeld Exp $ */
/* Copyright (c) 1996 by Internet Software Consortium.
*
@@ -52,7 +52,7 @@
"#Id: hesiod_p.h,v 1.1 1996/12/08 21:39:37 ghudson Exp #");
__IDSTRING(rcsid_hescompat_c,
"#Id: hescompat.c,v 1.1.2.1 1996/12/16 08:37:45 ghudson Exp #");
-__RCSID("$NetBSD: hesiod.c,v 1.15 2000/10/31 12:47:21 lukem Exp $");
+__RCSID("$NetBSD: hesiod.c,v 1.16 2001/02/13 15:41:18 sommerfeld Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -198,7 +198,10 @@
_DIAGASSERT(name != NULL);
_DIAGASSERT(type != NULL);
- strcpy(bindname, name);
+ if (strlcpy(bindname, name, sizeof(bindname)) >= sizeof(bindname)) {
+ errno = EMSGSIZE;
+ return NULL;
+ }
/*
* Find the right right hand side to use, possibly
Home |
Main Index |
Thread Index |
Old Index