commit 500a99769e8db0b627a376b311c5436367192817
parent afc242d83cb480ecd0ec09f0dd43f3389df73f89
Author: Christoph Lohmann <20h@r-36.net>
Date: Wed, 2 Mar 2011 16:10:09 +0100
Eroding GCC4 and OpenBSD ideology warnings.
Diffstat:
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/handlr.c b/handlr.c
@@ -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;
diff --git a/ind.c b/ind.c
@@ -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;
}
diff --git a/main.c b/main.c
@@ -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,