summaryrefslogtreecommitdiff
path: root/usr.sbin/ppp/command.c
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>1997-12-18 01:10:27 +0000
committerbrian <brian@cvs.openbsd.org>1997-12-18 01:10:27 +0000
commit2fcde60e0f33befff25fc6c3e2a2010c923a704b (patch)
tree42d57f293073052cdff0914e7f8c6c3a38a33327 /usr.sbin/ppp/command.c
parent5926ec4d15989689aa36f550da3212dcbc424cb3 (diff)
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/command.c')
-rw-r--r--usr.sbin/ppp/command.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index 0e6f7bde0ad..8866badb18d 100644
--- a/usr.sbin/ppp/command.c
+++ b/usr.sbin/ppp/command.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: command.c,v 1.8 1997/12/18 00:28:48 brian Exp $
+ * $Id: command.c,v 1.9 1997/12/18 01:10:25 brian Exp $
*
*/
#include <sys/param.h>
@@ -1360,7 +1360,8 @@ SetVariable(struct cmdargs const *arg)
case VAR_PHONE:
strncpy(VarPhoneList, argp, sizeof(VarPhoneList) - 1);
VarPhoneList[sizeof(VarPhoneList) - 1] = '\0';
- strcpy(VarPhoneCopy, VarPhoneList);
+ strncpy(VarPhoneCopy, VarPhoneList, sizeof(VarPhoneCopy));
+ VarPhoneCopy[sizeof(VarPhoneCopy) - 1] = '\0';
VarNextPhone = VarPhoneCopy;
VarAltPhone = NULL;
break;