ports/146618: 8.0-RELEASE cgilib-0.6 segfault

Byron Young bkyoung74q9 at yahoo.com
Sat May 15 16:00:17 UTC 2010


>Number:         146618
>Category:       ports
>Synopsis:       8.0-RELEASE cgilib-0.6 segfault
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 15 16:00:16 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Byron Young
>Release:        8.0-RELEASE
>Organization:
>Environment:
i386 8.0-RELEASE
>Description:
Using a HTML 4.0 <FORM> element <SELECT> element with attribute MULTIPLE results in segfault. A patch combining port 8.0-RELEASE patch and fix is attached.

>How-To-Repeat:
Create a binary linked with cgilib-0.6 and place into cgi-bin(apache22/mod_cgi) directory. Multiple selections from a <SELECT> element with attribute MULTIPLE will cause a segfault after submit.
>Fix:
*** cgilib-0.6/cgi.c	Sun Apr  6 02:43:41 2008
--- cgilib-0.6-bky/cgi.c	Thu May 13 19:08:58 2010
***************
*** 227,232 ****
--- 227,256 ----
      return strdup (template);
  }
  
+ 
+ size_t
+ strnlen(const char *s, size_t len)
+ {
+     size_t i;
+ 
+     for(i = 0; i < len && s[i]; i++)
+ 	;
+     return i;
+ }
+ 
+ char *
+ strndup(const char *old, size_t sz)
+ {
+     size_t len = strnlen (old, sz);
+     char *t    = malloc(len + 1);
+ 
+     if (t != NULL) {
+ 	memcpy (t, old, len);
+ 	t[len] = '\0';
+     }
+     return t;
+ }
+ 
  /* cgiReadMultipart()
   *
   * Decode multipart/form-data
***************
*** 637,643 ****
  		free (result[k]->value);
  		free (value);
  		result[k]->value = sptr;
! 		cgiDebugOutput (1, "%s: %s", result[i]->name, result[i]->value);
  	    }
  	}
  	cp = ++ip;
--- 661,667 ----
  		free (result[k]->value);
  		free (value);
  		result[k]->value = sptr;
! 		cgiDebugOutput (1, "%s: %s", result[k]->name, result[k]->value);
  	    }
  	}
  	cp = ++ip;

*** Makefile.orig	Thu May 13 19:11:56 2010
--- Makefile	Thu May 13 19:12:12 2010
***************
*** 24,29 ****
--- 24,31 ----
  		cgiGetVariables.3 cgiHeader.3 cgiInit.3 cgiRedirect.3 \
  		cgiSetHeader.3 cgiSetType.3
  
+ PATCH_STRIP=	-p1
+ 
  post-install:
  	${INSTALL_DATA} ${WRKSRC}/cgi.h ${PREFIX}/include
  	${INSTALL_MAN} ${WRKSRC}/*.3 ${PREFIX}/man/man3


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list