mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-21 15:45:02 +00:00
sizeof(foo - 1) isn't the same as sizeof(foo) - 1.
Pointed out by: Theo De Raadt.
This commit is contained in:
parent
4d40ec2fb9
commit
5dbf068b1e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=36815
@ -42,7 +42,7 @@ static const char copyright[] =
|
||||
static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id: tip.c,v 1.7 1997/09/18 14:07:17 phk Exp $";
|
||||
"$Id: tip.c,v 1.8 1998/06/09 04:28:05 imp Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -153,9 +153,9 @@ main(argc, argv)
|
||||
* Copy the number then stomp on the original (in case the number
|
||||
* is private, we don't want 'ps' or 'w' to find it).
|
||||
*/
|
||||
if (strlen(system) > sizeof(PNbuf - 1))
|
||||
if (strlen(system) > sizeof(PNbuf) - 1)
|
||||
errx(1, "phone number too long (max = %d bytes)", sizeof PNbuf - 1);
|
||||
strncpy(PNbuf, system, sizeof(PNbuf - 1));
|
||||
strncpy(PNbuf, system, sizeof(PNbuf) - 1);
|
||||
for (p = system; *p; p++)
|
||||
*p = '\0';
|
||||
PN = PNbuf;
|
||||
|
Loading…
Reference in New Issue
Block a user