$Id: update-patches 24 2008-08-31 14:56:13Z wbx $
--- wifidog-1.1.5.orig/libhttpd/api.c	2007-11-01 21:04:20.000000000 +0100
+++ wifidog-1.1.5/libhttpd/api.c	2008-10-16 13:15:26.000000000 +0200
@@ -166,7 +166,7 @@ int httpdAddVariable(request *r, char *n
 	while(*name == ' ' || *name == '\t')
 		name++;
 	newVar = malloc(sizeof(httpVar));
-	bzero(newVar, sizeof(httpVar));
+	memset(newVar, 0, sizeof(httpVar));
 	newVar->name = strdup(name);
 	newVar->value = strdup(value);
 	lastVar = NULL;
@@ -209,14 +209,14 @@ httpd *httpdCreate(host, port)
 	new = malloc(sizeof(httpd));
 	if (new == NULL)
 		return(NULL);
-	bzero(new, sizeof(httpd));
+	memset(new, 0, sizeof(httpd));
 	new->port = port;
 	if (host == HTTP_ANY_ADDR)
 		new->host = HTTP_ANY_ADDR;
 	else
 		new->host = strdup(host);
 	new->content = (httpDir*)malloc(sizeof(httpDir));
-	bzero(new->content,sizeof(httpDir));
+	memset(new->content, 0, sizeof(httpDir));
 	new->content->name = strdup("");
 
 	/*
@@ -270,7 +270,7 @@ httpd *httpdCreate(host, port)
 	setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&opt,sizeof(int));
 #	endif
 	new->serverSock = sock;
-	bzero(&addr, sizeof(addr));
+	memset(&addr, 0, sizeof(addr));
 	addr.sin_family = AF_INET;
 	if (new->host == HTTP_ANY_ADDR)
 	{
@@ -344,7 +344,7 @@ request *httpdGetConnection(server, time
 	}
 	memset((void *)r, 0, sizeof(request));
 	/* Get on with it */
-	bzero(&addr, sizeof(addr));
+	memset(&addr, 0, sizeof(addr));
 	addrLen = sizeof(addr);
 	r->clientSock = accept(server->serverSock,(struct sockaddr *)&addr,
 		&addrLen);
@@ -469,14 +469,14 @@ int httpdReadRequest(httpd *server, requ
 					*val,
 					*end;
 
-				var = index(buf,':');
+				var = strchr(buf,':');
 				while(var)
 				{
 					var++;
-					val = index(var, '=');
+					val = strchr(var, '=');
 					*val = 0;
 					val++;
-					end = index(val,';');
+					end = strchr(val,';');
 					if(end)
 						*end = 0;
 					httpdAddVariable(r, var, val);
@@ -488,7 +488,7 @@ int httpdReadRequest(httpd *server, requ
 #if 0
 			if (strncasecmp(buf,"Authorization: ",15) == 0)
 			{
-				cp = index(buf,':') + 2;
+				cp = strchr(buf,':') + 2;
 				if (strncmp(cp,"Basic ", 6) != 0)
 				{
 					/* Unknown auth method */
@@ -497,11 +497,11 @@ int httpdReadRequest(httpd *server, requ
 				{
 					char 	authBuf[100];
 
-					cp = index(cp,' ') + 1;
+					cp = strchr(cp,' ') + 1;
 					_httpd_decode(cp, authBuf, 100);
 					r->request.authLength = 
 						strlen(authBuf);
-					cp = index(authBuf,':');
+					cp = strchr(authBuf,':');
 					if (cp)
 					{
 						*cp = 0;
@@ -517,7 +517,7 @@ int httpdReadRequest(httpd *server, requ
 #if 0
 			if (strncasecmp(buf,"Referer: ",9) == 0)
 			{
-				cp = index(buf,':') + 2;
+				cp = strchr(buf,':') + 2;
 				if(cp)
 				{
 					strncpy(r->request.referer,cp,
@@ -529,7 +529,7 @@ int httpdReadRequest(httpd *server, requ
 			 * present. */
 			if (strncasecmp(buf,"Host: ",6) == 0)
 			{
-				cp = index(buf,':') + 2;
+				cp = strchr(buf,':') + 2;
 				if(cp)
 				{
 					strncpy(r->request.host,cp,
@@ -540,12 +540,12 @@ int httpdReadRequest(httpd *server, requ
 #if 0
 			if (strncasecmp(buf,"If-Modified-Since: ",19) == 0)
 			{
-				cp = index(buf,':') + 2;
+				cp = strchr(buf,':') + 2;
 				if(cp)
 				{
 					strncpy(r->request.ifModified,cp,
 						HTTP_MAX_URL);
-					cp = index(r->request.ifModified,
+					cp = strchr(r->request.ifModified,
 						';');
 					if (cp)
 						*cp = 0;
@@ -553,7 +553,7 @@ int httpdReadRequest(httpd *server, requ
 			}
 			if (strncasecmp(buf,"Content-Type: ",14) == 0)
 			{
-				cp = index(buf,':') + 2;
+				cp = strchr(buf,':') + 2;
 				if(cp)
 				{
 					strncpy(r->request.contentType,cp,
@@ -562,7 +562,7 @@ int httpdReadRequest(httpd *server, requ
 			}
 			if (strncasecmp(buf,"Content-Length: ",16) == 0)
 			{
-				cp = index(buf,':') + 2;
+				cp = strchr(buf,':') + 2;
 				if(cp)
 					r->request.contentLength=atoi(cp);
 			}
@@ -581,7 +581,7 @@ int httpdReadRequest(httpd *server, requ
 	*/
 	if (r->request.contentLength > 0)
 	{
-		bzero(buf, HTTP_MAX_LEN);
+		memset(buf, 0, HTTP_MAX_LEN);
 		_httpd_readBuf(r, buf, r->request.contentLength);
 		_httpd_storeData(r, buf);
 		
@@ -591,7 +591,7 @@ int httpdReadRequest(httpd *server, requ
 	/*
 	** Process any URL data
 	*/
-	cp = index(r->request.path,'?');
+	cp = strchr(r->request.path,'?');
 	if (cp != NULL)
 	{
 		*cp++ = 0;
@@ -661,7 +661,7 @@ int httpdAddFileContent(server, dir, nam
 	newEntry =  malloc(sizeof(httpContent));
 	if (newEntry == NULL)
 		return(-1);
-	bzero(newEntry,sizeof(httpContent));
+	memset(newEntry, 0, sizeof(httpContent));
 	newEntry->name = strdup(name);
 	newEntry->type = HTTP_FILE;
 	newEntry->indexFlag = indexFlag;
@@ -699,7 +699,7 @@ int httpdAddWildcardContent(server, dir,
 	newEntry =  malloc(sizeof(httpContent));
 	if (newEntry == NULL)
 		return(-1);
-	bzero(newEntry,sizeof(httpContent));
+	memset(newEntry, 0, sizeof(httpContent));
 	newEntry->name = NULL;
 	newEntry->type = HTTP_WILDCARD;
 	newEntry->indexFlag = HTTP_FALSE;
@@ -755,7 +755,7 @@ int httpdAddCContent(server, dir, name, 
 	newEntry =  malloc(sizeof(httpContent));
 	if (newEntry == NULL)
 		return(-1);
-	bzero(newEntry,sizeof(httpContent));
+	memset(newEntry, 0, sizeof(httpContent));
 	newEntry->name = strdup(name);
 	newEntry->type = HTTP_C_FUNCT;
 	newEntry->indexFlag = indexFlag;
@@ -780,7 +780,7 @@ int httpdAddCWildcardContent(server, dir
 	newEntry =  malloc(sizeof(httpContent));
 	if (newEntry == NULL)
 		return(-1);
-	bzero(newEntry,sizeof(httpContent));
+	memset(newEntry, 0, sizeof(httpContent));
 	newEntry->name = NULL;
 	newEntry->type = HTTP_C_WILDCARD;
 	newEntry->indexFlag = HTTP_FALSE;
@@ -805,7 +805,7 @@ int httpdAddStaticContent(server, dir, n
 	newEntry =  malloc(sizeof(httpContent));
 	if (newEntry == NULL)
 		return(-1);
-	bzero(newEntry,sizeof(httpContent));
+	memset(newEntry, 0, sizeof(httpContent));
 	newEntry->name = strdup(name);
 	newEntry->type = HTTP_STATIC;
 	newEntry->indexFlag = indexFlag;
@@ -946,7 +946,7 @@ void httpdProcessRequest(httpd *server, 
 
 	r->response.responseLength = 0;
 	strncpy(dirName, httpdRequestPath(r), HTTP_MAX_URL);
-	cp = rindex(dirName, '/');
+	cp = strrchr(dirName, '/');
 	if (cp == NULL)
 	{
 		printf("Invalid request path '%s'\n",dirName);