summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/chat.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-12-18 01:10:13 +0000
committerbrian <brian@FreeBSD.org>1997-12-18 01:10:13 +0000
commitad6dc08636347bbd8aebe3658eabf43dadb4aa90 (patch)
treeaafc13d009a2e0a3d0723158fd0477a09d74d91e /usr.sbin/ppp/chat.c
parent71fc17164f9d8dcc7f930336a677c5601e0255dd (diff)
downloadFreeBSD-src-ad6dc08636347bbd8aebe3658eabf43dadb4aa90.zip
FreeBSD-src-ad6dc08636347bbd8aebe3658eabf43dadb4aa90.tar.gz
Replace
strcpy(a, b); /* a and b are the same size */ with strncpy(a, b, sizeof(a)); a[sizeof(a)-1] = '\0'; Making the code `correct at a glance'. Suggested by: Theo de Raadt <deraadt@cvs.openbsd.org>
Diffstat (limited to 'usr.sbin/ppp/chat.c')
-rw-r--r--usr.sbin/ppp/chat.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/ppp/chat.c b/usr.sbin/ppp/chat.c
index 396927e..5026c37 100644
--- a/usr.sbin/ppp/chat.c
+++ b/usr.sbin/ppp/chat.c
@@ -18,7 +18,7 @@
* Columbus, OH 43221
* (614)451-1883
*
- * $Id: chat.c,v 1.38 1997/11/09 14:18:36 brian Exp $
+ * $Id: chat.c,v 1.39 1997/11/22 03:37:26 brian Exp $
*
* TODO:
* o Support more UUCP compatible control sequences.
@@ -186,7 +186,8 @@ ExpandString(const char *str, char *result, int reslen, int sendmode)
case 'T':
if (VarAltPhone == NULL) {
if (VarNextPhone == NULL) {
- strcpy(VarPhoneCopy, VarPhoneList);
+ strncpy(VarPhoneCopy, VarPhoneList, sizeof(VarPhoneCopy));
+ VarPhoneCopy[sizeof(VarPhoneCopy) - 1] = '\0';
VarNextPhone = VarPhoneCopy;
}
VarAltPhone = strsep(&VarNextPhone, ":");
OpenPOWER on IntegriCloud