Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/usr.bin/error pullup 1.6->1.8 (christos): string overru...
details: https://anonhg.NetBSD.org/src/rev/6cbc6fc4a7b9
branches: netbsd-1-4
changeset: 468818:6cbc6fc4a7b9
user: perry <perry%NetBSD.org@localhost>
date: Mon Jun 21 16:17:44 1999 +0000
description:
pullup 1.6->1.8 (christos): string overruns caused by incorrect bounds check
diffstat:
usr.bin/error/subr.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diffs (94 lines):
diff -r a2f42ccac947 -r 6cbc6fc4a7b9 usr.bin/error/subr.c
--- a/usr.bin/error/subr.c Mon Jun 21 16:16:20 1999 +0000
+++ b/usr.bin/error/subr.c Mon Jun 21 16:17:44 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr.c,v 1.6 1998/11/06 23:10:08 christos Exp $ */
+/* $NetBSD: subr.c,v 1.6.2.1 1999/06/21 16:17:44 perry Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: subr.c,v 1.6 1998/11/06 23:10:08 christos Exp $");
+__RCSID("$NetBSD: subr.c,v 1.6.2.1 1999/06/21 16:17:44 perry Exp $");
#endif /* not lint */
#include <ctype.h>
@@ -71,7 +71,7 @@
array[listindex] = errorp;
errorp->error_position = listindex;
}
- array[listindex] = (Eptr)0;
+ array[listindex] = NULL;
*e_length = listlength;
*e_array = array;
}
@@ -141,7 +141,7 @@
char *string;
{
int length;
- if (string == 0) return('\0');
+ if (string == NULL) return('\0');
length = strlen(string);
if (length >= 1)
return(string[length-1]);
@@ -164,7 +164,7 @@
char *string;
{
int length;
- if (string == 0) return('\0');
+ if (string == NULL) return('\0');
length = strlen(string);
if (length >= 2)
return(string[length - 2]);
@@ -345,25 +345,25 @@
for (wordcount = 0, cp = string; *cp; wordcount++){
while (*cp && isspace((unsigned char)*cp))
cp++;
- if (*cp == 0)
+ if (*cp == '\0')
break;
- while (!isspace((unsigned char)*cp))
+ while (*cp && !isspace((unsigned char)*cp))
cp++;
}
wordv = (char **)Calloc(wordcount + 1, sizeof (char *));
for (cp=string,wordindex=0; wordcount; wordindex++,--wordcount){
while (*cp && isspace((unsigned char)*cp))
cp++;
- if (*cp == 0)
+ if (*cp == '\0')
break;
wordv[wordindex] = cp;
- while(!isspace((unsigned char)*cp))
+ while(*cp && !isspace((unsigned char)*cp))
cp++;
*cp++ = '\0';
}
if (wordcount != 0)
errx(6, "Initial miscount of the number of words in a line");
- wordv[wordindex] = (char *)0;
+ wordv[wordindex] = NULL;
#ifdef FULLDEBUG
for (wordcount = 0; wordcount < wordindex; wordcount++)
printf("Word %d = \"%s\"\n", wordcount, wordv[wordcount]);
@@ -386,7 +386,7 @@
int back;
for (i = 0; i < wordc; i++){
- if (wordv1[i] == 0 || wordv2[i] == 0)
+ if (wordv1[i] == NULL || wordv2[i] == NULL)
return(-1);
if ((back = strcmp(wordv1[i], wordv2[i])) != NULL)
return(back);
@@ -410,7 +410,7 @@
nwordv = (char **)Calloc(nwordc, sizeof (char *));
for (i = 0; i < emptyhead; i++)
- nwordv[i] = 0;
+ nwordv[i] = NULL;
for(i = emptyhead; i < nwordc; i++){
nwordv[i] = wordv[i-emptyhead];
}
Home |
Main Index |
Thread Index |
Old Index