diff options
author | brian <brian@cvs.openbsd.org> | 1997-12-23 22:38:04 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 1997-12-23 22:38:04 +0000 |
commit | 5b328ddb5aa49cb7e5e4d9072e21d9e4b1f90acd (patch) | |
tree | 4340619842ab0940f8d489b47a4806655b4d5afa /usr.sbin/ppp/modem.c | |
parent | 54118aee3c311f24af1c94a68759b0863cf8392f (diff) |
strncpy(x,y,sizeof(x)) --> strncpy(x,y,sizeof(x)-1)
Suggested by: Philippe Charnier <charnier@lirmm.fr>
Theo de Raadt <deraadt@cvs.openbsd.org>
Diffstat (limited to 'usr.sbin/ppp/modem.c')
-rw-r--r-- | usr.sbin/ppp/modem.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index fcdffe3bcbb..d6cf4b53b00 100644 --- a/usr.sbin/ppp/modem.c +++ b/usr.sbin/ppp/modem.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: modem.c,v 1.3 1997/12/21 03:15:54 brian Exp $ + * $Id: modem.c,v 1.4 1997/12/23 22:38:03 brian Exp $ * * TODO: */ @@ -466,12 +466,12 @@ OpenModem() return modem = 0; } } else { - strncpy(tmpDeviceList, VarDeviceList, sizeof(tmpDeviceList)); + strncpy(tmpDeviceList, VarDeviceList, sizeof(tmpDeviceList)-1); tmpDeviceList[sizeof(tmpDeviceList)-1] = '\0'; for(tmpDevice=strtok(tmpDeviceList, ","); tmpDevice && (modem < 0); tmpDevice=strtok(NULL,",")) { - strncpy(VarDevice, tmpDevice, sizeof(VarDevice)); + strncpy(VarDevice, tmpDevice, sizeof(VarDevice)-1); VarDevice[sizeof(VarDevice)-1]= '\0'; VarBaseDevice = strrchr(VarDevice, '/'); VarBaseDevice = VarBaseDevice ? VarBaseDevice + 1 : ""; @@ -700,7 +700,7 @@ HangupModem(int flag) if (modem >= 0) { char ScriptBuffer[SCRIPT_LEN]; - strncpy(ScriptBuffer, VarHangupScript, sizeof(ScriptBuffer)); + strncpy(ScriptBuffer, VarHangupScript, sizeof(ScriptBuffer)-1); ScriptBuffer[sizeof(ScriptBuffer) - 1] = '\0'; LogPrintf(LogDEBUG, "HangupModem: Script: %s\n", ScriptBuffer); if (flag || !(mode & MODE_DEDICATED)) { |