| @@ -188,7 +188,7 @@ handlecgi(int sock, char *file, char *port, char *base, char *args,
if(sear == nil)
sear = "";
- execl(file, p, sear, args, nil);
+ execl(file, p, sear, args, (char *)nil);
close(sock);
return; |
| @@ -142,11 +142,14 @@ freeindex(Indexs *i)
void
addelem(Elems *e, char *s)
{
+ int slen;
+
+ slen = strlen(s) + 1;
e->num++;
e->e = realloc(e->e, sizeof(char *) * e->num);
- e->e[e->num - 1] = gmallocz(strlen(s) + 1, 0);
- strcpy(e->e[e->num - 1], s);
+ e->e[e->num - 1] = gmallocz(slen, 0);
+ strncpy(e->e[e->num - 1], s, slen - 1);
return;
} |
| @@ -133,9 +133,9 @@ handlerequest(int sock, char *base, char *ohost, char *port, char *clienth,
int len, fd;
filetype *type;
- memset(&dir, 0, sizeof(dir));
- memset(recvb, 0, sizeof(recvb));
- memset(recvc, 0, sizeof(recvc));
+ bzero(&dir, sizeof(dir));
+ bzero(recvb, sizeof(recvb));
+ bzero(recvc, sizeof(recvc));
len = recv(sock, recvb, sizeof(recvb), 0);
if(len > 1) {
@@ -144,7 +144,7 @@ handlerequest(int sock, char *base, char *ohost, char *port, char *clienth,
if(recvb[len - 1] == '\n')
recvb[len - 1] = '\0';
}
- strcpy(recvc, recvb);
+ strncpy(recvc, recvb, sizeof(recvc) - 1);
if(!strncmp(recvb, "URL:", 4)) {
len = snprintf(path, sizeof(path), htredir, |