openbsd-ports/www/webalizer/patches/patch-linklist_c
danh 926ea2c6c1 update to webalizer 2.01-10
* bump NEED_VERSION
* security fix: buffer overflow in DNS resolver
* includes other bugfixes
* some strcpy/strncpy/sprintf calls changed to strlcpy/snprintf
2002-04-17 16:17:45 +00:00

34 lines
1.2 KiB
Plaintext

$OpenBSD: patch-linklist_c,v 1.1 2002/04/17 16:17:45 danh Exp $
--- linklist.c.orig Wed Apr 17 11:15:16 2002
+++ linklist.c Wed Apr 17 11:18:20 2002
@@ -118,7 +118,7 @@ NLISTPTR new_nlist(char *str)
fprintf(stderr,"[new_nlist] %s\n",msg_big_one);
}
if (( newptr = malloc(sizeof(struct nlist))) != NULL)
- {strncpy(newptr->string, str, sizeof(newptr->string));newptr->next=NULL;}
+ {strlcpy(newptr->string, str, sizeof(newptr->string));newptr->next=NULL;}
return newptr;
}
@@ -176,8 +176,8 @@ GLISTPTR new_glist(char *str, char *name
}
if (( newptr = malloc(sizeof(struct glist))) != NULL)
{
- strncpy(newptr->string, str, sizeof(newptr->string));
- strncpy(newptr->name, name, sizeof(newptr->name));
+ strlcpy(newptr->string, str, sizeof(newptr->string));
+ strlcpy(newptr->name, name, sizeof(newptr->name));
newptr->next=NULL;
}
return newptr;
@@ -194,8 +194,7 @@ int add_glist(char *str, GLISTPTR *list)
char *name=temp_buf;
/* make local copy of string */
- strncpy(temp_buf,str,79);
- temp_buf[79]=0;
+ strlcpy(temp_buf,str,sizeof temp_buf);
while (!isspace((int)*name)&&*name!=0) name++;
if (*name==0) name=temp_buf;