From: KyoungSoo Park Date: Fri, 6 Jun 2008 01:31:14 +0000 (+0000) Subject: - fixed a bug which makes the function stack overflow in some cases X-Git-Tag: CoDemux-0.1-12~2 X-Git-Url: http://git.onelab.eu/?p=codemux.git;a=commitdiff_plain;h=a445559e39bb43f8a5d63a27e602ac45452f0f80 - fixed a bug which makes the function stack overflow in some cases --- diff --git a/codemux.c b/codemux.c index 7d55e0d..4e4fabe 100644 --- a/codemux.c +++ b/codemux.c @@ -457,7 +457,7 @@ static int FindService(FlowBuf *fb, int *whichService, struct in_addr addr) { char *end; - char *lowerBuf; + char lowerBuf[FB_ALLOCSIZE]; char *hostVal; char *buf = fb->fb_buf; char orig[256]; @@ -466,7 +466,7 @@ FindService(FlowBuf *fb, int *whichService, struct in_addr addr) int i; int len; #endif - + if (strstr(buf, "\n\r\n") == NULL && strstr(buf, "\n\n") == NULL) return(FAILURE); @@ -475,7 +475,7 @@ FindService(FlowBuf *fb, int *whichService, struct in_addr addr) fb->fb_used += InsertHeader(buf, fb->fb_used + 1, orig); /* get just the header, so we can work on it */ - LOCAL_STR_DUP_LOWER(lowerBuf, buf); + StrcpyLower(lowerBuf, buf); if ((end = strstr(lowerBuf, "\n\r\n")) == NULL) end = strstr(lowerBuf, "\n\n"); *end = '\0'; @@ -503,7 +503,6 @@ FindService(FlowBuf *fb, int *whichService, struct in_addr addr) DoesDotlessSuffixMatch(hostVal, 0, serviceSig[i].ss_host)) { *whichService = i; free(hostVal); - /* printf("%s", buf); */ return(SUCCESS); } }