Hi,

attached is a security update for php5 on 4.1-stable. Please report any
breakage you see. If I don't get any negative feedback, this will be
committed next friday.

A diff for 4.0 should follow soon.

Nikolay

-- 
"It's all part of my Can't-Do approach to life." Wally
Index: Makefile.inc
===================================================================
RCS file: /cvs/ports/www/php5/Makefile.inc,v
retrieving revision 1.13
diff -p -u -r1.13 Makefile.inc
--- Makefile.inc        24 Oct 2006 09:30:25 -0000      1.13
+++ Makefile.inc        10 Jun 2007 16:44:37 -0000
@@ -70,3 +70,6 @@ PATCH_LIST=           ${.CURDIR}/../patches/patch
                        patch-*
 PATCHFILES=            suhosin-patch-${V}-${SUHOSIN_V}.patch.gz:1
 PATCH_DIST_STRIP=      -p1
+
+post-extract:
+       @find ${WRKSRC} -name \*.orig -exec rm {} \;
Index: core/Makefile
===================================================================
RCS file: /cvs/ports/www/php5/core/Makefile,v
retrieving revision 1.19
diff -p -u -r1.19 Makefile
--- core/Makefile       25 Nov 2006 11:09:04 -0000      1.19
+++ core/Makefile       10 Jun 2007 16:44:37 -0000
@@ -4,8 +4,8 @@ MULTI_PACKAGES= -main -pear
 
 COMMENT-main=  "server-side HTML-embedded scripting language"
 COMMENT-pear=  "base classes for common PHP tasks"
-PKGNAME-main=  php5-core-${V}p0
-FULLPKGNAME-pear= php5-pear-${V}p0
+PKGNAME-main=  php5-core-${V}p1
+FULLPKGNAME-pear= php5-pear-${V}p1
 DISTFILES=     php-${V}.tar.gz \
                pear-${PEAR_V}.tar.gz:0
 
@@ -50,7 +50,6 @@ PREFIX-pear=          ${CHROOT_DIR}
 RUN_DEPENDS-pear=      :php5-core-${V}:www/php5/core
 WANTLIB-pear=
 LIB_DEPENDS-pear=
-
 
 pre-fake:
        ${INSTALL_DATA_DIR} ${PREFIX}/${APACHE_MODULE_SUBDIR}
Index: extensions/Makefile
===================================================================
RCS file: /cvs/ports/www/php5/extensions/Makefile,v
retrieving revision 1.32
diff -p -u -r1.32 Makefile
--- extensions/Makefile 9 Feb 2007 13:48:20 -0000       1.32
+++ extensions/Makefile 10 Jun 2007 16:44:37 -0000
@@ -1,6 +1,6 @@
 # $OpenBSD: Makefile,v 1.32 2007/02/09 13:48:20 bernd Exp $
 
-FULLPKGNAME-main=              php5-extensions-${V}p0
+FULLPKGNAME-main=              php5-extensions-${V}p1
 COMMENT-main=          "informational package about PHP5 extensions"
 
 MULTI_PACKAGES=        -main
@@ -48,7 +48,7 @@ COMMENT-curl=         "curl URL library extensi
 CONFIGURE_ARGS+=       --with-curl=shared,${LOCALBASE}
 LIB_DEPENDS-curl=      curl.>=2::net/curl
 WANTLIB-curl=          ${WANTLIB} crypto ssl z
-FULLPKGNAME-curl=      php5-curl-${V}p2
+FULLPKGNAME-curl=      php5-curl-${V}p3
 .endif
 
 # dba
@@ -101,11 +101,11 @@ CONFIGURE_ARGS+=  --with-gd=shared ${GRAP
 
 . if ${FLAVOR:L:Mno_x11}
 CONFIGURE_ARGS+=       --without-xpm-dir --without-freetype-dir
-FULLPKGNAME-gd=                php5-gd-${V}-no_x11p2
+FULLPKGNAME-gd=                php5-gd-${V}-no_x11p3
 . else
 USE_X11=               yes
 CONFIGURE_ARGS+=       --with-xpm-dir=${X11BASE}
-FULLPKGNAME-gd=                php5-gd-${V}p1
+FULLPKGNAME-gd=                php5-gd-${V}p2
 WANTLIB-gd+=           X11 Xpm freetype
 . endif
 .endif
@@ -290,7 +290,7 @@ MULTI_PACKAGES+=    -sybase_ct
 COMMENT-sybase_ct=     "sybase database access extensions for php5"
 CONFIGURE_ARGS+=        --with-sybase-ct=shared,${LOCALBASE}
 LIB_DEPENDS-sybase_ct= ct::databases/freetds
-FULLPKGNAME-sybase_ct= php5-sybase_ct-${V}p2
+FULLPKGNAME-sybase_ct= php5-sybase_ct-${V}p3
 .endif
 
 # xml-rpc
@@ -318,7 +318,7 @@ WANTLIB-xsl=                ${WANTLIB} iconv xml2 z
 .endif
 
 .for i in ${MULTI_PACKAGES}
-FULLPKGNAME${i} ?=     php5${i}-${V}p1
+FULLPKGNAME${i} ?=     php5${i}-${V}p2
 RUN_DEPENDS${i}=       :php5-core-${V}:www/php5/core
 MODULE_NAME${i}=       ${i:S/-//g}
 .endfor
Index: extensions/patches/patch-ext_gd_config_m4
===================================================================
RCS file: /cvs/ports/www/php5/extensions/patches/patch-ext_gd_config_m4,v
retrieving revision 1.4
diff -p -u -r1.4 patch-ext_gd_config_m4
--- extensions/patches/patch-ext_gd_config_m4   9 May 2006 14:15:40 -0000       
1.4
+++ extensions/patches/patch-ext_gd_config_m4   10 Jun 2007 16:44:37 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-ext_gd_config_m4,v 1.4 2006/05/09 14:15:40 robert Exp $
---- ext/gd/config.m4.orig      Fri Apr 28 00:56:27 2006
-+++ ext/gd/config.m4   Fri Apr 28 00:57:11 2006
-@@ -87,13 +87,13 @@
+--- ext/gd/config.m4.orig      Tue Nov 29 19:25:59 2005
++++ ext/gd/config.m4   Sun Jun 10 18:10:52 2007
+@@ -87,13 +87,13 @@ AC_DEFUN([PHP_GD_PNG],[
        AC_MSG_ERROR([PNG support requires ZLIB. Use --with-zlib-dir=<DIR>])
      fi
  
Index: extensions/patches/patch-ext_gd_gdttf_c
===================================================================
RCS file: /cvs/ports/www/php5/extensions/patches/patch-ext_gd_gdttf_c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 patch-ext_gd_gdttf_c
--- extensions/patches/patch-ext_gd_gdttf_c     2 Oct 2004 11:32:35 -0000       
1.1.1.1
+++ extensions/patches/patch-ext_gd_gdttf_c     10 Jun 2007 16:44:37 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-ext_gd_gdttf_c,v 1.1.1.1 2004/10/02 11:32:35 robert Exp $
---- ext/gd/gdttf.c.orig        Tue Jul 27 00:57:58 2004
-+++ ext/gd/gdttf.c     Tue Jul 27 00:58:59 2004
-@@ -712,7 +712,7 @@
+--- ext/gd/gdttf.c.orig        Sun Jan  9 22:05:05 2005
++++ ext/gd/gdttf.c     Sun Jun 10 18:10:52 2007
+@@ -712,7 +712,7 @@ gdttfchar(gdImage *im, int fg, font_t *f
                                }
  #if HAVE_LIBGD20
                                if (im->trueColor) {
Index: extensions/patches/patch-ext_gd_libgd_gdkanji_c
===================================================================
RCS file: /cvs/ports/www/php5/extensions/patches/patch-ext_gd_libgd_gdkanji_c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 patch-ext_gd_libgd_gdkanji_c
--- extensions/patches/patch-ext_gd_libgd_gdkanji_c     2 Oct 2004 11:32:35 
-0000       1.1.1.1
+++ extensions/patches/patch-ext_gd_libgd_gdkanji_c     10 Jun 2007 16:44:37 
-0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-ext_gd_libgd_gdkanji_c,v 1.1.1.1 2004/10/02 11:32:35 robert 
Exp $
---- ext/gd/libgd/gdkanji.c.orig        Tue Jul 27 01:02:49 2004
-+++ ext/gd/libgd/gdkanji.c     Tue Jul 27 01:03:21 2004
-@@ -362,7 +362,7 @@
+--- ext/gd/libgd/gdkanji.c.orig        Sun Dec 28 21:11:08 2003
++++ ext/gd/libgd/gdkanji.c     Sun Jun 10 18:10:52 2007
+@@ -362,7 +362,7 @@ do_convert (unsigned char *to, unsigned 
    from_len = strlen ((const char *) from) + 1;
    to_len = BUFSIZ;
  
Index: extensions/patches/patch-ext_imap_php_imap_c
===================================================================
RCS file: extensions/patches/patch-ext_imap_php_imap_c
diff -N extensions/patches/patch-ext_imap_php_imap_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ extensions/patches/patch-ext_imap_php_imap_c        10 Jun 2007 16:44:37 
-0000
@@ -0,0 +1,159 @@
+$OpenBSD$
+--- ext/imap/php_imap.c.orig   Fri Aug 11 17:07:13 2006
++++ ext/imap/php_imap.c        Sun Jun 10 16:02:20 2007
+@@ -62,6 +62,9 @@ MAILSTREAM DEFAULTPROTO;
+ #define CRLF_LEN sizeof("\015\012") - 1
+ #define PHP_EXPUNGE 32768
+ #define PHP_IMAP_ADDRESS_SIZE_BUF 10
++#ifndef SENDBUFLEN
++#define SENDBUFLEN 16385
++#endif
+ 
+ static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC);
+ static void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC);
+@@ -1152,13 +1155,13 @@ PHP_FUNCTION(imap_headers)
+               if ((i = cache->user_flags)) {
+                       strcat(tmp, "{");
+                       while (i) {
+-                              strcat(tmp, 
imap_le_struct->imap_stream->user_flags[find_rightmost_bit (&i)]);
+-                              if (i) strcat(tmp, " ");
++                              strlcat(tmp, 
imap_le_struct->imap_stream->user_flags[find_rightmost_bit (&i)], sizeof(tmp));
++                              if (i) strlcat(tmp, " ", sizeof(tmp));
+                       }
+-                      strcat(tmp, "} ");
++                      strlcat(tmp, "} ", sizeof(tmp));
+               }
+               mail_fetchsubject(t = tmp + strlen(tmp), 
imap_le_struct->imap_stream, msgno, (long)25);
+-              sprintf(t += strlen(t), " (%ld chars)", cache->rfc822_size);
++              snprintf(t += strlen(t), sizeof(tmp) - strlen(tmp),  " (%ld 
chars)", cache->rfc822_size);
+               add_next_index_string(return_value, tmp, 1);
+       }
+ }
+@@ -2915,7 +2918,7 @@ PHP_FUNCTION(imap_mail_compose)
+       BODY *bod=NULL, *topbod=NULL;
+       PART *mypart=NULL, *part;
+       PARAMETER *param, *disp_param = NULL, *custom_headers_param = NULL, 
*tmp_param = NULL;
+-      char tmp[8 * MAILTMPLEN], *mystring=NULL, *t=NULL, *tempstring=NULL;
++      char tmp[SENDBUFLEN + 1], *mystring=NULL, *t=NULL, *tempstring=NULL;
+       int toppart = 0;
+ 
+       if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &envelope, &body) 
== FAILURE) {
+@@ -3216,8 +3219,8 @@ PHP_FUNCTION(imap_mail_compose)
+               goto done;
+       }
+ 
+-      rfc822_encode_body_7bit(env, topbod); 
+-      rfc822_header (tmp, env, topbod);
++      rfc822_encode_body_7bit(env, topbod);
++      rfc822_header(tmp, env, topbod);
+ 
+       /* add custom envelope headers */
+       if (custom_headers_param) {
+@@ -3266,43 +3269,42 @@ PHP_FUNCTION(imap_mail_compose)
+               /* yucky default */
+                       if (!cookie) {
+                               cookie = "-";  
++                      } else if (strlen(cookie) > (sizeof(tmp) - 2 - 2)) {  
/* validate cookie length -- + CRLF */
++                              php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"The boudary should be no longer then 4kb");
++                              RETVAL_FALSE;
++                              goto done;      
+                       }
+ 
+               /* for each part */
+                       do {
+                               t=tmp;
+                       /* build cookie */
+-                              sprintf (t, "--%s%s", cookie, CRLF);
++                              sprintf(t, "--%s%s", cookie, CRLF);
+ 
+                       /* append mini-header */
+                               rfc822_write_body_header(&t, &part->body);
+ 
+                       /* write terminating blank line */
+-                              strcat (t, CRLF);
++                              strcat(t, CRLF);
+ 
+                       /* output cookie, mini-header, and contents */
+-                              
tempstring=emalloc(strlen(mystring)+strlen(tmp)+1);
+-                              sprintf(tempstring, "%s%s", mystring, tmp);
++                              spprintf(&tempstring, 0, "%s%s", mystring, tmp);
+                               efree(mystring);
+                               mystring=tempstring;
+ 
+                               bod=&part->body;
+ 
+-                              
tempstring=emalloc(strlen(bod->contents.text.data)+strlen(CRLF)+strlen(mystring)+1);
+-                              sprintf(tempstring, "%s%s%s", mystring, 
bod->contents.text.data, CRLF);
++                              spprintf(&tempstring, 0, "%s%s%s", mystring, 
bod->contents.text.data, CRLF);
+                               efree(mystring);
+                               mystring=tempstring;
+                       } while ((part = part->next)); /* until done */
+ 
+                       /* output trailing cookie */
+-                      sprintf(tmp, "--%s--", cookie);
+-                      
tempstring=emalloc(strlen(tmp)+strlen(CRLF)+strlen(mystring)+1);
+-                      sprintf(tempstring, "%s%s%s", mystring, tmp, CRLF);
++                      spprintf(&tempstring, 0, "%s--%s--%s", mystring, tmp, 
CRLF);
+                       efree(mystring);
+                       mystring=tempstring;
+       } else if (bod) {
+-                      tempstring = 
emalloc(strlen(bod->contents.text.data)+strlen(CRLF)+strlen(mystring)+1);
+-                      sprintf(tempstring, "%s%s%s", mystring, 
bod->contents.text.data, CRLF);
++                      spprintf(&tempstring, 0, "%s%s%s", mystring, 
bod->contents.text.data, CRLF);
+                       efree(mystring);
+                       mystring=tempstring;
+       } else {
+@@ -3350,14 +3352,14 @@ int _php_imap_mail(char *to, char *subje
+ #define PHP_IMAP_CLEAN        if (bufferTo) efree(bufferTo); if (bufferCc) 
efree(bufferCc); if (bufferBcc) efree(bufferBcc); if (bufferHeader) 
efree(bufferHeader);
+ #define PHP_IMAP_BAD_DEST PHP_IMAP_CLEAN; efree(tempMailTo); return 
(BAD_MSG_DESTINATION);
+ 
+-      bufferHeader = (char *)emalloc(bufferLen);
++      bufferHeader = (char *)emalloc(bufferLen + 1);
+       memset(bufferHeader, 0, bufferLen);
+       if (to && *to) {
+-              strcat(bufferHeader, "To: ");
+-              strcat(bufferHeader, to);
+-              strcat(bufferHeader, "\r\n");
++              strlcat(bufferHeader, "To: ", bufferLen + 1);
++              strlcat(bufferHeader, to, bufferLen + 1);
++              strlcat(bufferHeader, "\r\n", bufferLen + 1);
+               tempMailTo = estrdup(to);
+-              bufferTo = (char *)emalloc(strlen(to));
++              bufferTo = (char *)emalloc(strlen(to) + 1);
+               offset = 0;
+               addr = NULL;
+               rfc822_parse_adrlist(&addr, tempMailTo, NULL);
+@@ -3376,11 +3378,11 @@ int _php_imap_mail(char *to, char *subje
+       }
+ 
+       if (cc && *cc) {
+-              strcat(bufferHeader, "Cc: ");
+-              strcat(bufferHeader, cc);
+-              strcat(bufferHeader, "\r\n");
++              strlcat(bufferHeader, "Cc: ", bufferLen + 1);
++              strlcat(bufferHeader, cc, bufferLen + 1);
++              strlcat(bufferHeader, "\r\n", bufferLen + 1);
+               tempMailTo = estrdup(cc);
+-              bufferCc = (char *)emalloc(strlen(cc));
++              bufferCc = (char *)emalloc(strlen(cc) + 1);
+               offset = 0;
+               addr = NULL;
+               rfc822_parse_adrlist(&addr, tempMailTo, NULL);
+@@ -3400,7 +3402,7 @@ int _php_imap_mail(char *to, char *subje
+ 
+       if (bcc && *bcc) {
+               tempMailTo = estrdup(bcc);
+-              bufferBcc = (char *)emalloc(strlen(bcc));
++              bufferBcc = (char *)emalloc(strlen(bcc) + 1);
+               offset = 0;
+               addr = NULL;
+               rfc822_parse_adrlist(&addr, tempMailTo, NULL);
+@@ -3419,7 +3421,7 @@ int _php_imap_mail(char *to, char *subje
+       }
+ 
+       if (headers && *headers) {
+-              strcat(bufferHeader, headers);
++              strlcat(bufferHeader, headers, bufferLen + 1);
+       }
+ 
+       if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, bufferHeader, 
subject, bufferTo, message, bufferCc, bufferBcc, rpath TSRMLS_CC) != SUCCESS) {
Index: extensions/patches/patch-ext_mbstring_mb_gpc_c
===================================================================
RCS file: extensions/patches/patch-ext_mbstring_mb_gpc_c
diff -N extensions/patches/patch-ext_mbstring_mb_gpc_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ extensions/patches/patch-ext_mbstring_mb_gpc_c      10 Jun 2007 16:44:37 
-0000
@@ -0,0 +1,26 @@
+$OpenBSD$
+--- ext/mbstring/mb_gpc.c.orig Sun Jan  1 13:50:08 2006
++++ ext/mbstring/mb_gpc.c      Sun Jun 10 16:12:39 2007
+@@ -206,9 +206,8 @@ enum mbfl_no_encoding _php_mb_encoding_h
+       /* register_globals stuff
+        * XXX: this feature is going to be deprecated? */
+ 
+-      if (info->force_register_globals) {
+-              prev_rg_state = PG(register_globals);
+-              PG(register_globals) = 1;
++      if (info->force_register_globals && !(prev_rg_state = 
PG(register_globals))) {
++              zend_alter_ini_entry("register_globals", 
sizeof("register_globals"), "1", sizeof("1")-1, PHP_INI_PERDIR, 
PHP_INI_STAGE_RUNTIME);
+       }
+ 
+       if (!res || *res == '\0') {
+@@ -341,8 +340,8 @@ enum mbfl_no_encoding _php_mb_encoding_h
+ 
+ out:
+       /* register_global stuff */
+-      if (info->force_register_globals) {
+-              PG(register_globals) = prev_rg_state;
++      if (info->force_register_globals && !prev_rg_state) {
++              zend_alter_ini_entry("register_globals", 
sizeof("register_globals"), "0", sizeof("0")-1, PHP_INI_PERDIR, 
PHP_INI_STAGE_RUNTIME);
+       }
+ 
+       if (convd != NULL) {
Index: extensions/patches/patch-ext_mbstring_mbstring_c
===================================================================
RCS file: extensions/patches/patch-ext_mbstring_mbstring_c
diff -N extensions/patches/patch-ext_mbstring_mbstring_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ extensions/patches/patch-ext_mbstring_mbstring_c    10 Jun 2007 16:44:37 
-0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+--- ext/mbstring/mbstring.c.orig       Thu May 11 16:47:34 2006
++++ ext/mbstring/mbstring.c    Sun Jun 10 16:13:29 2007
+@@ -2849,8 +2849,8 @@ PHP_FUNCTION(mb_decode_numericentity)
+ 
+ #define SKIP_LONG_HEADER_SEP_MBSTRING(str, pos)                               
                                                \
+       if (str[pos] == '\r' && str[pos + 1] == '\n' && (str[pos + 2] == ' ' || 
str[pos + 2] == '\t')) {        \
+-              pos += 3;                                                       
                                \
+-              while (str[pos] == ' ' || str[pos] == '\t') {                   
                                \
++              pos += 2;                                                       
                                \
++              while (str[pos + 1] == ' ' || str[pos + 1] == '\t') {           
                                        \
+                       pos++;                                                  
                                \
+               }                                                               
                                \
+               continue;                                                       
                                \
Index: extensions/patches/patch-ext_odbc_php_odbc_c
===================================================================
RCS file: extensions/patches/patch-ext_odbc_php_odbc_c
diff -N extensions/patches/patch-ext_odbc_php_odbc_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ extensions/patches/patch-ext_odbc_php_odbc_c        10 Jun 2007 16:44:37 
-0000
@@ -0,0 +1,50 @@
+$OpenBSD$
+--- ext/odbc/php_odbc.c.orig   Sun Jan  1 13:50:10 2006
++++ ext/odbc/php_odbc.c        Sun Jun 10 16:07:48 2007
+@@ -1991,12 +1991,12 @@ PHP_FUNCTION(odbc_result_all)
+                                               RETURN_FALSE;
+                                       }
+                                       if (rc == SQL_SUCCESS_WITH_INFO)
+-                                              
php_printf(buf,result->longreadlen);
++                                              PHPWRITE(buf, 
result->longreadlen);
+                                       else if (result->values[i].vallen == 
SQL_NULL_DATA) {
+                                               php_printf("<td>NULL</td>");
+                                               break;
+                                       } else {
+-                                              php_printf(buf, 
result->values[i].vallen);
++                                              PHPWRITE(buf, 
result->values[i].vallen);
+                                       }
+                                       php_printf("</td>");
+                                       break;
+@@ -2097,23 +2097,23 @@ int odbc_sqlconnect(odbc_connection **co
+                        if (strstr(db, "pwd") || strstr(db, "PWD")) {
+                                pwd = NULL;
+                        }
+-                       strncpy( lpszConnStr, db, CONNSTRSIZE);
++                       strlcpy( lpszConnStr, db, CONNSTRSIZE);
+                }
+                else {
+                        strcpy(lpszConnStr, "DSN=");
+-                       strcat(lpszConnStr, db);
++                       strlcat(lpszConnStr, db, CONNSTRSIZE);
+                }
+                if (uid) {
+                        if (uid[0]) {
+-                               strcat(lpszConnStr, ";UID=");
+-                               strcat(lpszConnStr, uid);
+-                               strcat(lpszConnStr, ";");
++                               strlcat(lpszConnStr, ";UID=", CONNSTRSIZE);
++                               strlcat(lpszConnStr, uid, CONNSTRSIZE);
++                               strlcat(lpszConnStr, ";", CONNSTRSIZE);
+                        }
+                        if (pwd) {
+                                if (pwd[0]) {
+-                                       strcat(lpszConnStr, "PWD=");
+-                                       strcat(lpszConnStr, pwd);
+-                                       strcat(lpszConnStr, ";");
++                                       strlcat(lpszConnStr, "PWD=", 
CONNSTRSIZE);
++                                       strlcat(lpszConnStr, pwd, CONNSTRSIZE);
++                                       strlcat(lpszConnStr, ";", CONNSTRSIZE);
+                                }
+                        }
+                }
Index: extensions/patches/patch-ext_soap_php_http_c
===================================================================
RCS file: extensions/patches/patch-ext_soap_php_http_c
diff -N extensions/patches/patch-ext_soap_php_http_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ extensions/patches/patch-ext_soap_php_http_c        10 Jun 2007 16:44:37 
-0000
@@ -0,0 +1,34 @@
+$OpenBSD$
+--- ext/soap/php_http.c.orig   Thu Apr 13 10:18:36 2006
++++ ext/soap/php_http.c        Sun Jun 10 16:18:56 2007
+@@ -891,19 +891,20 @@ try_again:
+                               efree(http_body);
+                               efree(loc);
+                               if (new_url->scheme == NULL && new_url->path != 
NULL) {
+-                                      new_url->scheme = 
estrdup(phpurl->scheme);
+-                                      new_url->host = estrdup(phpurl->host);
++                                      new_url->scheme = NULL;
++                                      new_url->host = phpurl->host ? 
estrdup(phpurl->host) : NULL;
+                                       new_url->port = phpurl->port;
+                                       if (new_url->path && new_url->path[0] 
!= '/') {
+-                                              char *t = 
phpurl->path?phpurl->path:"/";
++                                              char *t = phpurl->path;
+                                               char *p = strrchr(t, '/');
+-                                              char *s = emalloc((p - t) + 
strlen(new_url->path) + 2);
+-
+-                                              strncpy(s, t, (p - t) + 1);
+-                                              s[(p - t) + 1] = 0;
+-                                              strcat(s, new_url->path);
+-                                              efree(new_url->path);
+-                                              new_url->path = s;
++                                              if (p) {
++                                                      char *s = emalloc((p - 
t) + strlen(new_url->path) + 2);
++                                                      strncpy(s, t, (p - t) + 
1);
++                                                      s[(p - t) + 1] = 0;
++                                                      strcat(s, 
new_url->path);
++                                                      efree(new_url->path);
++                                                      new_url->path = s;
++                                              }
+                                       }
+                               }
+                               phpurl = new_url;
Index: extensions/patches/patch-ext_sqlite_sess_sqlite_c
===================================================================
RCS file: extensions/patches/patch-ext_sqlite_sess_sqlite_c
diff -N extensions/patches/patch-ext_sqlite_sess_sqlite_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ extensions/patches/patch-ext_sqlite_sess_sqlite_c   10 Jun 2007 16:44:37 
-0000
@@ -0,0 +1,24 @@
+$OpenBSD$
+--- ext/sqlite/sess_sqlite.c.orig      Sun Jan  1 13:50:14 2006
++++ ext/sqlite/sess_sqlite.c   Sun Jun 10 16:14:39 2007
+@@ -31,6 +31,11 @@
+ extern int sqlite_encode_binary(const unsigned char *in, int n, unsigned char 
*out);
+ extern int sqlite_decode_binary(const unsigned char *in, unsigned char *out);
+ 
++#define php_sqlite_decode_binary(in, out)    (        \
++      (!in || !*in) ? 0 : \
++              sqlite_decode_binary((const unsigned char *)in, (unsigned char 
*)out) \
++)
++
+ PS_FUNCS(sqlite);
+ 
+ ps_module ps_mod_sqlite = {
+@@ -111,7 +116,7 @@ PS_READ_FUNC(sqlite) 
+                       if (rowdata[0] != NULL) {
+                               *vallen = strlen(rowdata[0]);
+                               *val = emalloc(*vallen);
+-                              *vallen = sqlite_decode_binary(rowdata[0], 
*val);
++                              *vallen = php_sqlite_decode_binary(rowdata[0], 
*val);
+                               (*val)[*vallen] = '\0';
+                       }
+                       break;
Index: extensions/patches/patch-ext_sqlite_sqlite_c
===================================================================
RCS file: extensions/patches/patch-ext_sqlite_sqlite_c
diff -N extensions/patches/patch-ext_sqlite_sqlite_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ extensions/patches/patch-ext_sqlite_sqlite_c        10 Jun 2007 16:44:37 
-0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+--- ext/sqlite/sqlite.c.orig   Tue Apr 18 16:30:15 2006
++++ ext/sqlite/sqlite.c        Sun Jun 10 16:14:39 2007
+@@ -72,7 +72,10 @@ extern int sqlite_encode_binary(const un
+ extern int sqlite_decode_binary(const unsigned char *in, unsigned char *out);
+ 
+ #define php_sqlite_encode_binary(in, n, out) sqlite_encode_binary((const 
unsigned char *)in, n, (unsigned char *)out)
+-#define php_sqlite_decode_binary(in, out)    sqlite_decode_binary((const 
unsigned char *)in, (unsigned char *)out)
++#define php_sqlite_decode_binary(in, out)    (        \
++      (!in || !*in) ? 0 : \
++              sqlite_decode_binary((const unsigned char *)in, (unsigned char 
*)out) \
++)
+ 
+ static int sqlite_count_elements(zval *object, long *count TSRMLS_DC);
+ 
Index: extensions/patches/patch-ext_xmlrpc_libxmlrpc_encodings_c
===================================================================
RCS file: 
/cvs/ports/www/php5/extensions/patches/patch-ext_xmlrpc_libxmlrpc_encodings_c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 patch-ext_xmlrpc_libxmlrpc_encodings_c
--- extensions/patches/patch-ext_xmlrpc_libxmlrpc_encodings_c   2 Oct 2004 
11:32:35 -0000       1.1.1.1
+++ extensions/patches/patch-ext_xmlrpc_libxmlrpc_encodings_c   10 Jun 2007 
16:44:37 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-ext_xmlrpc_libxmlrpc_encodings_c,v 1.1.1.1 2004/10/02 11:32:35 
robert Exp $
---- ext/xmlrpc/libxmlrpc/encodings.c.orig      Tue Jul 27 01:05:53 2004
-+++ ext/xmlrpc/libxmlrpc/encodings.c   Tue Jul 27 01:06:08 2004
-@@ -70,7 +70,7 @@
+--- ext/xmlrpc/libxmlrpc/encodings.c.orig      Tue Mar  9 00:04:33 2004
++++ ext/xmlrpc/libxmlrpc/encodings.c   Sun Jun 10 18:10:53 2007
+@@ -70,7 +70,7 @@ static char* convert(const char* src, in
           if(outbuf) {
              out_ptr = (char*)outbuf;
              while(inlenleft) {
Index: patches/patch-Zend_zend_hash_c
===================================================================
RCS file: patches/patch-Zend_zend_hash_c
diff -N patches/patch-Zend_zend_hash_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-Zend_zend_hash_c      10 Jun 2007 16:44:37 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+--- Zend/zend_hash.c.orig      Sun Jun 10 18:10:52 2007
++++ Zend/zend_hash.c   Sun Jun 10 18:10:52 2007
+@@ -324,11 +324,16 @@ ZEND_API int _zend_hash_init(HashTable *
+ 
+       SET_INCONSISTENT(HT_OK);
+ 
+-      while ((1U << i) < nSize) {
+-              i++;
++      if (nSize >= 0x80000000) {
++              /* prevent overflow */
++              ht->nTableSize = 0x80000000;
++      } else {
++              while ((1U << i) < nSize) {
++                      i++;
++              }
++              ht->nTableSize = 1 << i;
+       }
+ 
+-      ht->nTableSize = 1 << i;
+       ht->nTableMask = ht->nTableSize - 1;
+       ht->pDestructor = pDestructor;
+       zend_hash_add_destructor(pDestructor);
Index: patches/patch-aclocal_m4
===================================================================
RCS file: /cvs/ports/www/php5/patches/patch-aclocal_m4,v
retrieving revision 1.6
diff -p -u -r1.6 patch-aclocal_m4
--- patches/patch-aclocal_m4    9 May 2006 14:15:40 -0000       1.6
+++ patches/patch-aclocal_m4    10 Jun 2007 16:44:37 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-aclocal_m4,v 1.6 2006/05/09 14:15:40 robert Exp $
---- aclocal.m4.orig    Wed Nov 23 22:37:40 2005
-+++ aclocal.m4 Sat Nov 26 12:59:21 2005
-@@ -2100,10 +2100,9 @@
+--- aclocal.m4.orig    Wed Aug 23 14:55:01 2006
++++ aclocal.m4 Sun Jun 10 10:41:01 2007
+@@ -2129,10 +2129,9 @@ AC_DEFUN([PHP_SETUP_KERBEROS],[
      if test "$PHP_KERBEROS_DIR"; then
        found_kerberos=yes
        PHP_ADD_LIBPATH($PHP_KERBEROS_DIR/$PHP_LIBDIR, $1)
@@ -14,7 +14,7 @@ $OpenBSD: patch-aclocal_m4,v 1.6 2006/05
        PHP_ADD_INCLUDE($PHP_KERBEROS_DIR/include)
      fi
    fi
-@@ -4165,7 +4164,7 @@
+@@ -4202,7 +4201,7 @@ openbsd*)
      *)                         need_version=no  ;;
    esac
    library_names_spec='${libname}${release}${shared_ext}$versuffix 
${libname}${shared_ext}$versuffix'
Index: patches/patch-configure_in
===================================================================
RCS file: /cvs/ports/www/php5/patches/patch-configure_in,v
retrieving revision 1.5
diff -p -u -r1.5 patch-configure_in
--- patches/patch-configure_in  9 May 2006 14:15:40 -0000       1.5
+++ patches/patch-configure_in  10 Jun 2007 16:44:37 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-configure_in,v 1.5 2006/05/09 14:15:40 robert Exp $
---- configure.in.orig  Tue Nov 29 16:01:38 2005
-+++ configure.in       Tue Nov 29 16:02:41 2005
-@@ -816,7 +816,7 @@
+--- configure.in.orig  Sun Jun 10 18:10:52 2007
++++ configure.in       Sun Jun 10 18:11:14 2007
+@@ -886,7 +886,7 @@ enable_static=yes
  
  case $php_build_target in
  program|static)
@@ -10,7 +10,7 @@ $OpenBSD: patch-configure_in,v 1.5 2006/
      if test -z "$PHP_MODULES"; then
          enable_shared=no
      fi
-@@ -824,8 +824,8 @@
+@@ -894,8 +894,8 @@ program|static)
  shared)
      enable_static=no
      case $with_pic in
@@ -21,7 +21,7 @@ $OpenBSD: patch-configure_in,v 1.5 2006/
      esac
      EXTRA_LDFLAGS="$EXTRA_LDFLAGS -avoid-version -module"
  ;;
-@@ -1009,7 +1009,7 @@
+@@ -1079,7 +1079,7 @@ EXPANDED_SYSCONFDIR=`eval echo $sysconfd
  EXPANDED_DATADIR=$datadir
  EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
  EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"`
Index: patches/patch-ext_bcmath_libbcmath_src_output_c
===================================================================
RCS file: 
/cvs/ports/www/php5/patches/Attic/patch-ext_bcmath_libbcmath_src_output_c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 patch-ext_bcmath_libbcmath_src_output_c
--- patches/patch-ext_bcmath_libbcmath_src_output_c     2 Oct 2004 11:32:37 
-0000       1.1.1.1
+++ patches/patch-ext_bcmath_libbcmath_src_output_c     10 Jun 2007 16:44:37 
-0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-ext_bcmath_libbcmath_src_output_c,v 1.1.1.1 2004/10/02 
11:32:37 robert Exp $
---- ext/bcmath/libbcmath/src/output.c.orig     Mon Jul 26 23:09:43 2004
-+++ ext/bcmath/libbcmath/src/output.c  Mon Jul 26 23:09:22 2004
-@@ -71,7 +71,7 @@
+--- ext/bcmath/libbcmath/src/output.c.orig     Fri Nov 22 10:25:29 2002
++++ ext/bcmath/libbcmath/src/output.c  Sun Jun 10 10:40:36 2007
+@@ -71,7 +71,7 @@ bc_out_long (val, size, space, out_char)
    int len, ix;
  
    if (space) (*out_char) (' ');
Index: patches/patch-ext_bcmath_libbcmath_src_rt_c
===================================================================
RCS file: 
/cvs/ports/www/php5/patches/Attic/patch-ext_bcmath_libbcmath_src_rt_c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 patch-ext_bcmath_libbcmath_src_rt_c
--- patches/patch-ext_bcmath_libbcmath_src_rt_c 2 Oct 2004 11:32:37 -0000       
1.1.1.1
+++ patches/patch-ext_bcmath_libbcmath_src_rt_c 10 Jun 2007 16:44:37 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-ext_bcmath_libbcmath_src_rt_c,v 1.1.1.1 2004/10/02 11:32:37 
robert Exp $
---- ext/bcmath/libbcmath/src/rt.c.orig Mon Jul 26 23:11:15 2004
-+++ ext/bcmath/libbcmath/src/rt.c      Mon Jul 26 23:11:49 2004
-@@ -45,7 +45,7 @@
+--- ext/bcmath/libbcmath/src/rt.c.orig Wed Nov 22 21:20:02 2000
++++ ext/bcmath/libbcmath/src/rt.c      Sun Jun 10 10:40:36 2007
+@@ -45,7 +45,7 @@ void bc_rt_warn (char *mesg ,...)
    char error_mesg [255];
  
    va_start (args, mesg);
@@ -10,7 +10,7 @@ $OpenBSD: patch-ext_bcmath_libbcmath_src
    va_end (args);
  
    fprintf (stderr, "bc math warning: %s\n", error_mesg);
-@@ -58,7 +58,7 @@
+@@ -58,7 +58,7 @@ void bc_rt_error (char *mesg ,...)
    char error_mesg [255];
  
    va_start (args, mesg);
Index: patches/patch-ext_calendar_calendar_c
===================================================================
RCS file: /cvs/ports/www/php5/patches/Attic/patch-ext_calendar_calendar_c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 patch-ext_calendar_calendar_c
--- patches/patch-ext_calendar_calendar_c       2 Oct 2004 11:32:37 -0000       
1.1.1.1
+++ patches/patch-ext_calendar_calendar_c       10 Jun 2007 16:44:37 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-ext_calendar_calendar_c,v 1.1.1.1 2004/10/02 11:32:37 robert 
Exp $
---- ext/calendar/calendar.c.orig       Mon Jul 26 23:12:25 2004
-+++ ext/calendar/calendar.c    Mon Jul 26 23:12:43 2004
-@@ -277,7 +277,7 @@
+--- ext/calendar/calendar.c.orig       Sun Jan  1 13:50:00 2006
++++ ext/calendar/calendar.c    Sun Jun 10 10:40:36 2007
+@@ -304,7 +304,7 @@ PHP_FUNCTION(cal_from_jd)
  
        calendar->from_jd(jd, &year, &month, &day);
  
Index: patches/patch-ext_ftp_ftp_c
===================================================================
RCS file: patches/patch-ext_ftp_ftp_c
diff -N patches/patch-ext_ftp_ftp_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-ext_ftp_ftp_c 10 Jun 2007 16:44:37 -0000
@@ -0,0 +1,20 @@
+$OpenBSD$
+--- ext/ftp/ftp.c.orig Mon Apr  3 11:14:33 2006
++++ ext/ftp/ftp.c      Sun Jun 10 16:18:31 2007
+@@ -1103,10 +1103,16 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cm
+       int             size;
+       char            *data;
+ 
++      if (strpbrk(cmd, "\r\n")) {
++              return 0;
++      } 
+       /* build the output buffer */
+       if (args && args[0]) {
+               /* "cmd args\r\n\0" */
+               if (strlen(cmd) + strlen(args) + 4 > FTP_BUFSIZE) {
++                      return 0;
++              }
++              if (strpbrk(args, "\r\n")) {
+                       return 0;
+               }
+               size = sprintf(ftp->outbuf, "%s %s\r\n", cmd, args);
Index: patches/patch-ext_iconv_iconv_c
===================================================================
RCS file: /cvs/ports/www/php5/patches/patch-ext_iconv_iconv_c,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 patch-ext_iconv_iconv_c
--- patches/patch-ext_iconv_iconv_c     2 Oct 2004 11:32:37 -0000       1.1.1.1
+++ patches/patch-ext_iconv_iconv_c     10 Jun 2007 16:44:37 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-ext_iconv_iconv_c,v 1.1.1.1 2004/10/02 11:32:37 robert Exp $
---- ext/iconv/iconv.c.orig     Mon Jul 26 22:41:02 2004
-+++ ext/iconv/iconv.c  Mon Jul 26 22:46:24 2004
-@@ -267,7 +267,7 @@
+--- ext/iconv/iconv.c.orig     Thu Apr 27 02:50:54 2006
++++ ext/iconv/iconv.c  Sun Jun 10 10:40:37 2007
+@@ -251,7 +251,7 @@ static php_iconv_err_t _php_iconv_append
  
                        out_p = (d)->c + (d)->len;
  
@@ -10,7 +10,7 @@ $OpenBSD: patch-ext_iconv_iconv_c,v 1.1.
  #if ICONV_SUPPORTS_ERRNO
                                switch (errno) { 
                                        case EINVAL:
-@@ -427,7 +427,7 @@
+@@ -411,7 +411,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_
        out_p = out_buf;
  
        while (in_left > 0) {
@@ -19,7 +19,7 @@ $OpenBSD: patch-ext_iconv_iconv_c,v 1.1.
                out_size = bsz - out_left;
                if (result == (size_t)(-1)) {
                        if (errno == E2BIG && in_left > 0) {
-@@ -541,7 +541,7 @@
+@@ -525,7 +525,7 @@ static php_iconv_err_t _php_iconv_strlen
  
                prev_in_left = in_left;
  
@@ -28,7 +28,7 @@ $OpenBSD: patch-ext_iconv_iconv_c,v 1.1.
                        if (prev_in_left == in_left) {
                                break;
                        }
-@@ -641,7 +641,7 @@
+@@ -638,7 +638,7 @@ static php_iconv_err_t _php_iconv_substr
  
                prev_in_left = in_left;
  
@@ -37,7 +37,7 @@ $OpenBSD: patch-ext_iconv_iconv_c,v 1.1.
                        if (prev_in_left == in_left) {
                                break;
                        }
-@@ -772,7 +772,7 @@
+@@ -769,7 +769,7 @@ static php_iconv_err_t _php_iconv_strpos
  
                prev_in_left = in_left;
  
@@ -46,7 +46,7 @@ $OpenBSD: patch-ext_iconv_iconv_c,v 1.1.
                        if (prev_in_left == in_left) {
  #if ICONV_SUPPORTS_ERRNO
                                switch (errno) {
-@@ -1025,7 +1025,7 @@
+@@ -1018,7 +1018,7 @@ static php_iconv_err_t _php_iconv_mime_e
  
                                        out_left = out_size - out_reserved;
  
@@ -55,7 +55,7 @@ $OpenBSD: patch-ext_iconv_iconv_c,v 1.1.
  #if ICONV_SUPPORTS_ERRNO
                                                switch (errno) {
                                                        case EINVAL:
-@@ -1125,7 +1125,7 @@
+@@ -1118,7 +1118,7 @@ static php_iconv_err_t _php_iconv_mime_e
                                        out_p = buf;
                                        out_left = out_size;
  
@@ -64,7 +64,7 @@ $OpenBSD: patch-ext_iconv_iconv_c,v 1.1.
  #if ICONV_SUPPORTS_ERRNO
                                                switch (errno) {
                                                        case EINVAL:
-@@ -2374,7 +2374,7 @@
+@@ -2376,7 +2376,7 @@ static int php_iconv_stream_filter_appen
                tcnt = self->stub_len;
  
                while (tcnt > 0) {
Index: patches/patch-ext_interbase_ibase_service_c
===================================================================
RCS file: patches/patch-ext_interbase_ibase_service_c
diff -N patches/patch-ext_interbase_ibase_service_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-ext_interbase_ibase_service_c 10 Jun 2007 16:44:37 -0000
@@ -0,0 +1,57 @@
+$OpenBSD$
+--- ext/interbase/ibase_service.c.orig Sun Jan  1 13:50:08 2006
++++ ext/interbase/ibase_service.c      Sun Jun 10 16:02:25 2007
+@@ -160,7 +160,7 @@ static void _php_ibase_user(INTERNAL_FUN
+       
+       for (i = 0; i < sizeof(user_flags); ++i) {
+               if (args[i] != NULL) {
+-                      int chunk = snprintf(&buf[spb_len], sizeof(buf) - 
spb_len, "%c%c%c%s",
++                      int chunk = slprintf(&buf[spb_len], sizeof(buf) - 
spb_len, "%c%c%c%s",
+                               user_flags[i], (char)args_len[i], 
(char)(args_len[i] >> 8), args[i]);
+                       
+                       if ((spb_len + chunk) > sizeof(buf) || chunk <= 0) {
+@@ -224,7 +224,7 @@ PHP_FUNCTION(ibase_service_attach)
+       }
+ 
+       /* construct the spb, hack the service name into it as well */
+-      spb_len = snprintf(buf, sizeof(buf), "%c%c%c%c%s%c%c%s" 
"%s:service_mgr",
++      spb_len = slprintf(buf, sizeof(buf), "%c%c%c%c%s%c%c%s" 
"%s:service_mgr",
+               isc_spb_version, isc_spb_current_version, isc_spb_user_name, 
(char)ulen,
+               user, isc_spb_password, (char)plen, pass, host);
+ 
+@@ -322,7 +322,7 @@ query_loop:
+                                       heap_p = heap_buf + res_size;
+                               }
+                               result += 2;
+-                              sprintf(heap_p, "%s\n", result);
++                              snprintf(heap_p, heap_buf_size - (heap_buf - 
heap_p), "%s\n", result);
+                               heap_p += line_len +2;
+                               goto query_loop; /* repeat until result is 
exhausted */
+ 
+@@ -440,7 +440,7 @@ static void _php_ibase_backup_restore(IN
+               "Interbase service manager handle", le_service);
+ 
+       /* fill the param buffer */
+-      spb_len = snprintf(buf, sizeof(buf), "%c%c%c%c%s%c%c%c%s%c%c%c%c%c",
++      spb_len = slprintf(buf, sizeof(buf), "%c%c%c%c%s%c%c%c%s%c%c%c%c%c",
+               operation, isc_spb_dbname, (char)dblen, (char)(dblen >> 8), db,
+               isc_spb_bkp_file, (char)bklen, (char)(bklen >> 8), bk, 
isc_spb_options,
+               (char)opts,(char)(opts >> 8), (char)(opts >> 16), (char)(opts 
>> 24));
+@@ -542,7 +542,7 @@ options_argument:
+                       case isc_spb_prp_deny_new_transactions:
+                       case isc_spb_prp_deny_new_attachments:
+                       case isc_spb_prp_set_sql_dialect:
+-                              spb_len = snprintf(buf, sizeof(buf), 
"%c%c%c%c%s%c%c%c%c%c",
++                              spb_len = slprintf(buf, sizeof(buf), 
"%c%c%c%c%s%c%c%c%c%c",
+                                       svc_action, isc_spb_dbname, 
(char)dblen, (char)(dblen >> 8), db,
+                                       (char)action, (char)argument, 
(char)(argument >> 8), (char)(argument >> 16),
+                                       (char)(argument >> 24));
+@@ -551,7 +551,7 @@ options_argument:
+                       case isc_spb_prp_reserve_space:
+                       case isc_spb_prp_write_mode:
+                       case isc_spb_prp_access_mode:
+-                              spb_len = snprintf(buf, sizeof(buf), 
"%c%c%c%c%s%c%c",
++                              spb_len = slprintf(buf, sizeof(buf), 
"%c%c%c%c%s%c%c",
+                                       isc_action_svc_properties, 
isc_spb_dbname, (char)dblen, (char)(dblen >> 8),
+                                       db, (char)action, (char)argument);
+               }
Index: patches/patch-ext_session_session_c
===================================================================
RCS file: patches/patch-ext_session_session_c
diff -N patches/patch-ext_session_session_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-ext_session_session_c 10 Jun 2007 16:44:37 -0000
@@ -0,0 +1,38 @@
+$OpenBSD$
+--- ext/session/session.c.orig Fri Feb 10 08:39:13 2006
++++ ext/session/session.c      Sun Jun 10 17:45:42 2007
+@@ -546,16 +546,20 @@ static void php_session_track_init(TSRML
+       zend_delete_global_variable("HTTP_SESSION_VARS", 
sizeof("HTTP_SESSION_VARS")-1 TSRMLS_CC);
+       zend_delete_global_variable("_SESSION", sizeof("_SESSION")-1 TSRMLS_CC);
+ 
++      if (PS(http_session_vars)) {
++              zval_ptr_dtor(&PS(http_session_vars));
++      }
++
+       MAKE_STD_ZVAL(session_vars);
+       array_init(session_vars);
+       PS(http_session_vars) = session_vars;
+       
+       if (PG(register_long_arrays)) {
+-              ZEND_SET_GLOBAL_VAR_WITH_LENGTH("HTTP_SESSION_VARS", 
sizeof("HTTP_SESSION_VARS"), PS(http_session_vars), 2, 1);
+-              ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), 
PS(http_session_vars), 2, 1);
++              ZEND_SET_GLOBAL_VAR_WITH_LENGTH("HTTP_SESSION_VARS", 
sizeof("HTTP_SESSION_VARS"), PS(http_session_vars), 3, 1);
++              ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), 
PS(http_session_vars), 3, 1);
+       }
+       else {
+-              ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), 
PS(http_session_vars), 1, 0);
++              ZEND_SET_GLOBAL_VAR_WITH_LENGTH("_SESSION", sizeof("_SESSION"), 
PS(http_session_vars), 2, 1);
+       }
+ }
+ 
+@@ -1763,6 +1767,10 @@ static void php_rinit_session_globals(TS
+ 
+ static void php_rshutdown_session_globals(TSRMLS_D)
+ {
++      if (PS(http_session_vars)) {
++              zval_ptr_dtor(&PS(http_session_vars));
++              PS(http_session_vars) = NULL;
++      }
+       if (PS(mod_data)) {
+               zend_try {
+                       PS(mod)->s_close(&PS(mod_data) TSRMLS_CC);
Index: patches/patch-ext_standard_formatted_print_c
===================================================================
RCS file: patches/patch-ext_standard_formatted_print_c
diff -N patches/patch-ext_standard_formatted_print_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-ext_standard_formatted_print_c        10 Jun 2007 16:44:37 
-0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+--- ext/standard/formatted_print.c.orig        Sun Jan  1 13:50:14 2006
++++ ext/standard/formatted_print.c     Sun Jun 10 16:07:53 2007
+@@ -485,9 +485,10 @@ php_formatted_print(int ht, int *len, in
+ {
+       zval ***args, **z_format;
+       int argc, size = 240, inpos = 0, outpos = 0, temppos;
+-      int alignment, width, precision, currarg, adjusting, argnum;
++      int alignment, currarg, adjusting;
+       char *format, *result, padding;
+       int always_sign;
++      long argnum, width, precision;
+ 
+       argc = ZEND_NUM_ARGS();
+ 
Index: patches/patch-ext_standard_mail_c
===================================================================
RCS file: patches/patch-ext_standard_mail_c
diff -N patches/patch-ext_standard_mail_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-ext_standard_mail_c   10 Jun 2007 16:44:37 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+--- ext/standard/mail.c.orig   Sun Jan  1 13:50:15 2006
++++ ext/standard/mail.c        Sun Jun 10 16:13:29 2007
+@@ -48,8 +48,8 @@
+ 
+ #define SKIP_LONG_HEADER_SEP(str, pos)                                        
                                        \
+       if (str[pos] == '\r' && str[pos + 1] == '\n' && (str[pos + 2] == ' ' || 
str[pos + 2] == '\t')) {        \
+-              pos += 3;                                                       
                                \
+-              while (str[pos] == ' ' || str[pos] == '\t') {                   
                                \
++              pos += 2;                                                       
                                \
++              while (str[pos + 1] == ' ' || str[pos + 1] == '\t') {           
                                        \
+                       pos++;                                                  
                                \
+               }                                                               
                                \
+               continue;                                                       
                                \
Index: patches/patch-ext_standard_streamsfuncs_c
===================================================================
RCS file: patches/patch-ext_standard_streamsfuncs_c
diff -N patches/patch-ext_standard_streamsfuncs_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-ext_standard_streamsfuncs_c   10 Jun 2007 16:44:37 -0000
@@ -0,0 +1,30 @@
+$OpenBSD$
+--- ext/standard/streamsfuncs.c.orig   Wed Apr 19 10:43:29 2006
++++ ext/standard/streamsfuncs.c        Sun Jun 10 16:02:39 2007
+@@ -359,7 +359,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
+               RETURN_FALSE;
+       }
+       
+-      read_buf = emalloc(to_read + 1);
++      read_buf = safe_emalloc(1, to_read, 1);
+       
+       recvd = php_stream_xport_recvfrom(stream, read_buf, to_read, flags, 
NULL, NULL,
+                       zremote ? &Z_STRVAL_P(zremote) : NULL,
+@@ -528,7 +528,7 @@ PHP_FUNCTION(stream_get_transports)
+               while (zend_hash_get_current_key_ex(stream_xport_hash,
+                                       &stream_xport, &stream_xport_len,
+                                       &num_key, 0, NULL) == 
HASH_KEY_IS_STRING) {
+-                      add_next_index_stringl(return_value, stream_xport, 
stream_xport_len, 1);
++                      add_next_index_stringl(return_value, stream_xport, 
stream_xport_len - 1, 1);
+                       zend_hash_move_forward(stream_xport_hash);
+               }
+       } else {
+@@ -556,7 +556,7 @@ PHP_FUNCTION(stream_get_wrappers)
+                       (key_flags = 
zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, 
&stream_protocol_len, &num_key, 0, NULL)) != HASH_KEY_NON_EXISTANT;
+                       zend_hash_move_forward(url_stream_wrappers_hash)) {
+                               if (key_flags == HASH_KEY_IS_STRING) {
+-                                      add_next_index_stringl(return_value, 
stream_protocol, stream_protocol_len, 1);
++                                      add_next_index_stringl(return_value, 
stream_protocol, stream_protocol_len - 1, 1);
+                               }
+               }
+       } else {
Index: patches/patch-ext_standard_string_c
===================================================================
RCS file: patches/patch-ext_standard_string_c
diff -N patches/patch-ext_standard_string_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-ext_standard_string_c 10 Jun 2007 16:44:37 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- ext/standard/string.c.orig Thu Aug 10 19:46:43 2006
++++ ext/standard/string.c      Sun Jun 10 11:58:42 2007
+@@ -3044,7 +3044,7 @@ PHPAPI int php_char_to_str_ex(char *str,
+       }
+       
+       Z_STRLEN_P(result) = len + (char_count * (to_len - 1));
+-      Z_STRVAL_P(result) = target = emalloc(Z_STRLEN_P(result) + 1);
++      Z_STRVAL_P(result) = target = safe_emalloc(char_count, to_len, len + 1);
+       Z_TYPE_P(result) = IS_STRING;
+       
+       for (source = str; source < source_end; source++) {
Index: patches/patch-ext_standard_user_filters_c
===================================================================
RCS file: patches/patch-ext_standard_user_filters_c
diff -N patches/patch-ext_standard_user_filters_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-ext_standard_user_filters_c   10 Jun 2007 16:44:37 -0000
@@ -0,0 +1,52 @@
+$OpenBSD$
+--- ext/standard/user_filters.c.orig   Thu Mar 30 23:10:23 2006
++++ ext/standard/user_filters.c        Sun Jun 10 16:55:04 2007
+@@ -238,6 +238,7 @@ static php_stream_filter *user_filter_fa
+       zval *obj, *zfilter;
+       zval func_name;
+       zval *retval = NULL;
++      int len;
+       
+       /* some sanity checks */
+       if (persistent) {
+@@ -246,9 +247,10 @@ static php_stream_filter *user_filter_fa
+               return NULL;
+       }
+ 
++      len = strlen(filtername);
++
+       /* determine the classname/class entry */
+-      if (FAILURE == zend_hash_find(BG(user_filter_map), (char*)filtername,
+-                              strlen(filtername), (void**)&fdat)) {
++      if (FAILURE == zend_hash_find(BG(user_filter_map), (char*)filtername, 
len + 1, (void**)&fdat)) {
+               char *period;
+ 
+               /* Userspace Filters using ambiguous wildcards could cause 
problems.
+@@ -257,15 +259,15 @@ static php_stream_filter *user_filter_fa
+            TODO: Allow failed userfilter creations to continue
+                  scanning through the list */
+               if ((period = strrchr(filtername, '.'))) {
+-                      char *wildcard;
++                      char *wildcard = emalloc(len + 3);
+ 
+                       /* Search for wildcard matches instead */
+-                      wildcard = estrdup(filtername);
++                      memcpy(wildcard, filtername, len + 1); /* copy \0 */
+                       period = wildcard + (period - filtername);
+                       while (period) {
+                               *period = '\0';
+                               strcat(wildcard, ".*");
+-                              if (SUCCESS == 
zend_hash_find(BG(user_filter_map), wildcard, strlen(wildcard), (void**)&fdat)) 
{
++                              if (SUCCESS == 
zend_hash_find(BG(user_filter_map), wildcard, strlen(wildcard) + 1, 
(void**)&fdat)) {
+                                       period = NULL;
+                               } else {
+                                       *period = '\0';
+@@ -539,7 +541,7 @@ PHP_FUNCTION(stream_filter_register)
+       fdat = ecalloc(1, sizeof(*fdat) + classname_len);
+       memcpy(fdat->classname, classname, classname_len);
+ 
+-      if (zend_hash_add(BG(user_filter_map), filtername, filtername_len, 
(void*)fdat,
++      if (zend_hash_add(BG(user_filter_map), filtername, filtername_len + 1, 
(void*)fdat,
+                               sizeof(*fdat) + classname_len, NULL) == SUCCESS 
&&
+                       php_stream_filter_register_factory_volatile(filtername, 
&user_filter_factory TSRMLS_CC) == SUCCESS) {
+               RETVAL_TRUE;
Index: patches/patch-ext_wddx_wddx_c
===================================================================
RCS file: patches/patch-ext_wddx_wddx_c
diff -N patches/patch-ext_wddx_wddx_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-ext_wddx_wddx_c       10 Jun 2007 16:44:37 -0000
@@ -0,0 +1,30 @@
+$OpenBSD$
+--- ext/wddx/wddx.c.orig       Thu May 25 12:01:30 2006
++++ ext/wddx/wddx.c    Sun Jun 10 16:07:17 2007
+@@ -284,7 +284,7 @@ PS_SERIALIZER_DECODE_FUNC(wddx)
+ 
+                       switch (hash_type) {
+                               case HASH_KEY_IS_LONG:
+-                                      sprintf(tmp, "%ld", idx);
++                                      key_length = sprintf(tmp, "%ld", idx) + 
1;
+                                       key = tmp;
+                                       /* fallthru */
+                               case HASH_KEY_IS_STRING:
+@@ -479,7 +479,7 @@ static void php_wddx_serialize_object(wd
+                       PHP_SET_CLASS_ATTRIBUTES(obj);
+ 
+                       php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
+-                      sprintf(tmp_buf, WDDX_VAR_S, PHP_CLASS_NAME_VAR);
++                      snprintf(tmp_buf, WDDX_BUF_LEN, WDDX_VAR_S, 
PHP_CLASS_NAME_VAR);
+                       php_wddx_add_chunk(packet, tmp_buf);
+                       php_wddx_add_chunk_static(packet, WDDX_STRING_S);
+                       php_wddx_add_chunk_ex(packet, class_name, name_len);
+@@ -511,7 +511,7 @@ static void php_wddx_serialize_object(wd
+               PHP_SET_CLASS_ATTRIBUTES(obj);
+ 
+               php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
+-              sprintf(tmp_buf, WDDX_VAR_S, PHP_CLASS_NAME_VAR);
++              snprintf(tmp_buf, WDDX_BUF_LEN, WDDX_VAR_S, PHP_CLASS_NAME_VAR);
+               php_wddx_add_chunk(packet, tmp_buf);
+               php_wddx_add_chunk_static(packet, WDDX_STRING_S);
+               php_wddx_add_chunk_ex(packet, class_name, name_len);
Index: patches/patch-main_SAPI_c
===================================================================
RCS file: patches/patch-main_SAPI_c
diff -N patches/patch-main_SAPI_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-main_SAPI_c   10 Jun 2007 16:44:37 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- main/SAPI.c.orig   Sun Jan  1 13:50:17 2006
++++ main/SAPI.c        Sun Jun 10 16:06:50 2007
+@@ -563,7 +563,7 @@ SAPI_API int sapi_header_op(sapi_header_
+       header_line = estrndup(header_line, header_line_len);
+ 
+       /* cut of trailing spaces, linefeeds and carriage-returns */
+-      while(isspace(header_line[header_line_len-1])) 
++      while(header_line_len && isspace(header_line[header_line_len-1])) 
+                 header_line[--header_line_len]='\0';
+       
+       /* new line safety check */
Index: patches/patch-main_php_h
===================================================================
RCS file: /cvs/ports/www/php5/patches/patch-main_php_h,v
retrieving revision 1.1
diff -p -u -r1.1 patch-main_php_h
--- patches/patch-main_php_h    24 Nov 2004 17:27:22 -0000      1.1
+++ patches/patch-main_php_h    10 Jun 2007 16:44:37 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-main_php_h,v 1.1 2004/11/24 17:27:22 robert Exp $
---- main/php.h.orig    Thu Nov 18 18:09:47 2004
-+++ main/php.h Thu Nov 18 18:29:09 2004
-@@ -149,7 +149,7 @@
+--- main/php.h.orig    Sun Jun 10 18:10:52 2007
++++ main/php.h Sun Jun 10 18:10:52 2007
+@@ -150,7 +150,7 @@ char *strtok_r(char *s, const char *deli
  END_EXTERN_C()
  #endif
  
Index: patches/patch-main_php_open_temporary_file_c
===================================================================
RCS file: /cvs/ports/www/php5/patches/patch-main_php_open_temporary_file_c,v
retrieving revision 1.2
diff -p -u -r1.2 patch-main_php_open_temporary_file_c
--- patches/patch-main_php_open_temporary_file_c        21 Oct 2006 11:44:10 
-0000      1.2
+++ patches/patch-main_php_open_temporary_file_c        10 Jun 2007 16:44:37 
-0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-main_php_open_temporary_file_c,v 1.2 2006/10/21 11:44:10 
robert Exp $
 --- main/php_open_temporary_file.c.orig        Wed May 24 01:22:26 2006
-+++ main/php_open_temporary_file.c     Fri Aug 18 21:15:57 2006
-@@ -120,7 +120,7 @@
++++ main/php_open_temporary_file.c     Sun Jun 10 10:40:37 2007
+@@ -120,7 +120,7 @@ static int php_do_open_temporary_file(co
                trailing_slash = "/";
        }
  
Index: patches/patch-main_php_variables_c
===================================================================
RCS file: patches/patch-main_php_variables_c
diff -N patches/patch-main_php_variables_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-main_php_variables_c  10 Jun 2007 16:44:37 -0000
@@ -0,0 +1,31 @@
+$OpenBSD$
+--- main/php_variables.c.orig  Wed May  3 13:24:29 2006
++++ main/php_variables.c       Sun Jun 10 16:08:18 2007
+@@ -603,8 +603,6 @@ int php_hash_environment(TSRMLS_D)
+ {
+       char *p;
+       unsigned char _gpc_flags[5] = {0, 0, 0, 0, 0};
+-      zval *dummy_track_vars_array = NULL;
+-      zend_bool initialized_dummy_track_vars_array=0;
+       zend_bool jit_initialization = (PG(auto_globals_jit) && 
!PG(register_globals) && !PG(register_long_arrays));
+       struct auto_global_record {
+               char *name;
+@@ -695,15 +693,9 @@ int php_hash_environment(TSRMLS_D)
+                       continue;
+               }
+               if (!PG(http_globals)[i]) {
+-                      if (!initialized_dummy_track_vars_array) {
+-                              ALLOC_ZVAL(dummy_track_vars_array);
+-                              array_init(dummy_track_vars_array);
+-                              INIT_PZVAL(dummy_track_vars_array);
+-                              initialized_dummy_track_vars_array = 1;
+-                      } else {
+-                              dummy_track_vars_array->refcount++;
+-                      }
+-                      PG(http_globals)[i] = dummy_track_vars_array;
++                      ALLOC_ZVAL(PG(http_globals)[i]);
++                      array_init(PG(http_globals)[i]);
++                      INIT_PZVAL(PG(http_globals)[i]);
+               }
+ 
+               PG(http_globals)[i]->refcount++;
Index: patches/patch-main_streams_filter_c
===================================================================
RCS file: patches/patch-main_streams_filter_c
diff -N patches/patch-main_streams_filter_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-main_streams_filter_c 10 Jun 2007 16:44:37 -0000
@@ -0,0 +1,13 @@
+$OpenBSD$
+--- main/streams/filter.c.orig Fri May 19 12:24:19 2006
++++ main/streams/filter.c      Sun Jun 10 16:14:06 2007
+@@ -264,7 +264,8 @@ PHPAPI php_stream_filter *php_stream_fil
+               /* try a wildcard */
+               char *wildname;
+ 
+-              wildname = estrdup(filtername);
++              wildname = emalloc(n+3);
++              memcpy(wildname, filtername, n+1);
+               period = wildname + (period - filtername);
+               while (period && !filter) {
+                       *period = '\0';
Index: patches/patch-main_streams_streams_c
===================================================================
RCS file: patches/patch-main_streams_streams_c
diff -N patches/patch-main_streams_streams_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-main_streams_streams_c        10 Jun 2007 16:44:37 -0000
@@ -0,0 +1,63 @@
+$OpenBSD$
+--- main/streams/streams.c.orig        Sat Apr 22 19:17:40 2006
++++ main/streams/streams.c     Sun Jun 10 16:03:46 2007
+@@ -1457,12 +1457,12 @@ PHPAPI int php_register_url_stream_wrapp
+               return FAILURE;
+       }
+ 
+-      return zend_hash_add(&url_stream_wrappers_hash, protocol, protocol_len, 
&wrapper, sizeof(wrapper), NULL);
++      return zend_hash_add(&url_stream_wrappers_hash, protocol, protocol_len 
+ 1, &wrapper, sizeof(wrapper), NULL);
+ }
+ 
+ PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC)
+ {
+-      return zend_hash_del(&url_stream_wrappers_hash, protocol, 
strlen(protocol));
++      return zend_hash_del(&url_stream_wrappers_hash, protocol, 
strlen(protocol) + 1);
+ }
+ 
+ static void clone_wrapper_hash(TSRMLS_D)
+@@ -1487,7 +1487,7 @@ PHPAPI int php_register_url_stream_wrapp
+               clone_wrapper_hash(TSRMLS_C);
+       }
+ 
+-      return zend_hash_add(FG(stream_wrappers), protocol, protocol_len, 
&wrapper, sizeof(wrapper), NULL);
++      return zend_hash_add(FG(stream_wrappers), protocol, protocol_len + 1, 
&wrapper, sizeof(wrapper), NULL);
+ }
+ 
+ PHPAPI int php_unregister_url_stream_wrapper_volatile(char *protocol 
TSRMLS_DC)
+@@ -1496,7 +1496,7 @@ PHPAPI int php_unregister_url_stream_wra
+               clone_wrapper_hash(TSRMLS_C);
+       }
+ 
+-      return zend_hash_del(FG(stream_wrappers), protocol, strlen(protocol));
++      return zend_hash_del(FG(stream_wrappers), protocol, strlen(protocol) + 
1);
+ }
+ /* }}} */
+ 
+@@ -1530,7 +1530,8 @@ PHPAPI php_stream_wrapper *php_stream_lo
+       }
+ 
+       if (protocol)   {
+-              if (FAILURE == zend_hash_find(wrapper_hash, (char*)protocol, n, 
(void**)&wrapperpp))    {
++              char *tmp = estrndup(protocol, n);
++              if (FAILURE == zend_hash_find(wrapper_hash, (char*)tmp, n + 1, 
(void**)&wrapperpp))     {
+                       char wrapper_name[32];
+ 
+                       if (n >= sizeof(wrapper_name))
+@@ -1543,6 +1544,7 @@ PHPAPI php_stream_wrapper *php_stream_lo
+                       wrapperpp = NULL;
+                       protocol = NULL;
+               }
++              efree(tmp);
+       }
+       /* TODO: curl based streams probably support file:// properly */
+       if (!protocol || !strncasecmp(protocol, "file", n))     {
+@@ -1591,7 +1593,7 @@ PHPAPI php_stream_wrapper *php_stream_lo
+                       }
+                       
+                       /* Check again, the original check might have not known 
the protocol name */
+-                      if (zend_hash_find(wrapper_hash, "file", 
sizeof("file")-1, (void**)&wrapperpp) == SUCCESS) {
++                      if (zend_hash_find(wrapper_hash, "file", 
sizeof("file"), (void**)&wrapperpp) == SUCCESS) {
+                               return *wrapperpp;
+                       }
+ 
Index: patches/patch-main_streams_transports_c
===================================================================
RCS file: patches/patch-main_streams_transports_c
diff -N patches/patch-main_streams_transports_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-main_streams_transports_c     10 Jun 2007 16:44:37 -0000
@@ -0,0 +1,40 @@
+$OpenBSD$
+--- main/streams/transports.c.orig     Sun Jun 10 17:51:52 2007
++++ main/streams/transports.c  Sun Jun 10 17:53:28 2007
+@@ -31,12 +31,12 @@ PHPAPI HashTable *php_stream_xport_get_h
+ 
+ PHPAPI int php_stream_xport_register(char *protocol, 
php_stream_transport_factory factory TSRMLS_DC)
+ {
+-      return zend_hash_update(&xport_hash, protocol, strlen(protocol), 
&factory, sizeof(factory), NULL);
++      return zend_hash_update(&xport_hash, protocol, strlen(protocol) + 1, 
&factory, sizeof(factory), NULL);
+ }
+ 
+ PHPAPI int php_stream_xport_unregister(char *protocol TSRMLS_DC)
+ {
+-      return zend_hash_del(&xport_hash, protocol, strlen(protocol));
++      return zend_hash_del(&xport_hash, protocol, strlen(protocol) + 1);
+ }
+ 
+ #define ERR_REPORT(out_err, fmt, arg) \
+@@ -106,7 +106,8 @@ PHPAPI php_stream *_php_stream_xport_cre
+       }
+ 
+       if (protocol) {
+-              if (FAILURE == zend_hash_find(&xport_hash, (char*)protocol, n, 
(void**)&factory)) {
++              char *tmp = estrndup(protocol, n);
++              if (FAILURE == zend_hash_find(&xport_hash, (char*)tmp, n + 1, 
(void**)&factory)) {
+                       char wrapper_name[32];
+ 
+                       if (n >= sizeof(wrapper_name))
+@@ -115,9 +116,10 @@ PHPAPI php_stream *_php_stream_xport_cre
+               
+                       ERR_REPORT(error_string, "Unable to find the socket 
transport \"%s\" - did you forget to enable it when you configured PHP?",
+                                       wrapper_name);
+-
++                      efree(tmp);
+                       return NULL;
+               }
++              efree(tmp);
+       }
+ 
+       if (factory == NULL) {
Index: patches/patch-php_ini-dist
===================================================================
RCS file: /cvs/ports/www/php5/patches/patch-php_ini-dist,v
retrieving revision 1.6
diff -p -u -r1.6 patch-php_ini-dist
--- patches/patch-php_ini-dist  9 May 2006 14:15:40 -0000       1.6
+++ patches/patch-php_ini-dist  10 Jun 2007 16:44:37 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-php_ini-dist,v 1.6 2006/05/09 14:15:40 robert Exp $
---- php.ini-dist.orig  Tue Nov 15 00:14:23 2005
-+++ php.ini-dist       Sat Nov 26 13:18:08 2005
-@@ -441,10 +441,7 @@
+--- php.ini-dist.orig  Mon Aug 14 20:40:19 2006
++++ php.ini-dist       Sun Jun 10 10:40:37 2007
+@@ -451,10 +451,7 @@ default_mimetype = "text/html"
  ;;;;;;;;;;;;;;;;;;;;;;;;;
  
  ; UNIX: "/path1:/path2"
@@ -13,7 +13,7 @@ $OpenBSD: patch-php_ini-dist,v 1.6 2006/
  
  ; The root of the PHP pages, used only if nonempty.
  ; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
-@@ -458,7 +455,7 @@
+@@ -468,7 +465,7 @@ doc_root =
  user_dir =
  
  ; Directory in which the loadable extensions (modules) reside.
@@ -22,7 +22,7 @@ $OpenBSD: patch-php_ini-dist,v 1.6 2006/
  
  ; Whether or not to enable the dl() function.  The dl() function does NOT work
  ; properly in multithreaded servers, such as IIS or Zeus, and is automatically
-@@ -519,7 +516,7 @@
+@@ -529,7 +526,7 @@ upload_max_filesize = 2M
  ;;;;;;;;;;;;;;;;;;
  
  ; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
@@ -31,7 +31,7 @@ $OpenBSD: patch-php_ini-dist,v 1.6 2006/
  
  ; Define the anonymous ftp password (your email address)
  ;from="[EMAIL PROTECTED]"
-@@ -537,70 +534,6 @@
+@@ -547,70 +544,6 @@ default_socket_timeout = 60
  ; fgets() and file() will work regardless of the source of the file.
  ; auto_detect_line_endings = Off
  
@@ -102,7 +102,7 @@ $OpenBSD: patch-php_ini-dist,v 1.6 2006/
  ;;;;;;;;;;;;;;;;;;;
  ; Module Settings ;
  ;;;;;;;;;;;;;;;;;;;
-@@ -616,13 +549,6 @@
+@@ -626,13 +559,6 @@ default_socket_timeout = 60
  define_syslog_variables  = Off
  
  [mail function]
@@ -116,7 +116,7 @@ $OpenBSD: patch-php_ini-dist,v 1.6 2006/
  ; For Unix only.  You may supply arguments as well (default: "sendmail -t 
-i").
  ;sendmail_path =
  
-@@ -1173,6 +1099,53 @@
+@@ -1198,6 +1124,53 @@ soap.wsdl_cache_dir="/tmp"
  ; instead of original one.
  soap.wsdl_cache_ttl=86400
  
Index: patches/patch-php_ini-recommended
===================================================================
RCS file: /cvs/ports/www/php5/patches/patch-php_ini-recommended,v
retrieving revision 1.6
diff -p -u -r1.6 patch-php_ini-recommended
--- patches/patch-php_ini-recommended   9 May 2006 14:15:40 -0000       1.6
+++ patches/patch-php_ini-recommended   10 Jun 2007 16:44:37 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-php_ini-recommended,v 1.6 2006/05/09 14:15:40 robert Exp $
---- php.ini-recommended.orig   Tue Nov 15 00:14:23 2005
-+++ php.ini-recommended        Sat Nov 26 13:19:47 2005
-@@ -499,10 +499,7 @@
+--- php.ini-recommended.orig   Mon Aug 14 20:40:19 2006
++++ php.ini-recommended        Sun Jun 10 10:40:37 2007
+@@ -509,10 +509,7 @@ default_mimetype = "text/html"
  ;;;;;;;;;;;;;;;;;;;;;;;;;
  
  ; UNIX: "/path1:/path2"
@@ -13,7 +13,7 @@ $OpenBSD: patch-php_ini-recommended,v 1.
  
  ; The root of the PHP pages, used only if nonempty.
  ; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
-@@ -516,7 +513,7 @@
+@@ -526,7 +523,7 @@ doc_root =
  user_dir =
  
  ; Directory in which the loadable extensions (modules) reside.
@@ -22,7 +22,7 @@ $OpenBSD: patch-php_ini-recommended,v 1.
  
  ; Whether or not to enable the dl() function.  The dl() function does NOT work
  ; properly in multithreaded servers, such as IIS or Zeus, and is automatically
-@@ -577,7 +574,7 @@
+@@ -587,7 +584,7 @@ upload_max_filesize = 2M
  ;;;;;;;;;;;;;;;;;;
  
  ; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
@@ -31,7 +31,7 @@ $OpenBSD: patch-php_ini-recommended,v 1.
  
  ; Define the anonymous ftp password (your email address)
  ;from="[EMAIL PROTECTED]"
-@@ -595,70 +592,6 @@
+@@ -605,70 +602,6 @@ default_socket_timeout = 60
  ; fgets() and file() will work regardless of the source of the file.
  ; auto_detect_line_endings = Off
  
@@ -102,7 +102,7 @@ $OpenBSD: patch-php_ini-recommended,v 1.
  ;;;;;;;;;;;;;;;;;;;
  ; Module Settings ;
  ;;;;;;;;;;;;;;;;;;;
-@@ -674,13 +607,6 @@
+@@ -684,13 +617,6 @@ default_socket_timeout = 60
  define_syslog_variables  = Off
  
  [mail function]
@@ -116,7 +116,7 @@ $OpenBSD: patch-php_ini-recommended,v 1.
  ; For Unix only.  You may supply arguments as well (default: "sendmail -t 
-i").
  ;sendmail_path =
  
-@@ -1231,6 +1157,53 @@
+@@ -1256,6 +1182,53 @@ soap.wsdl_cache_dir="/tmp"
  ; instead of original one.
  soap.wsdl_cache_ttl=86400
  

Reply via email to