cvs: php4 /ext/imap php_imap.c

From: Date: Fri, 18 Aug 2000 16:02:28 +0000
Subject: cvs: php4 /ext/imap php_imap.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-1225@lists.php.net to get a copy of this message
chagenbu Fri Aug 18 09:02:28 2000 EDT Modified files: /php4/ext/imap php_imap.c Log: use estrndup and efree to hopefully avoid both munging of arguments and leaking memory. Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.41 php4/ext/imap/php_imap.c:1.42 --- php4/ext/imap/php_imap.c:1.41 Thu Aug 17 09:01:14 2000 +++ php4/ext/imap/php_imap.c Fri Aug 18 09:02:27 2000 @@ -25,7 +25,7 @@ | PHP 4.0 updates: Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_imap.c,v 1.41 2000/08/17 16:01:14 chagenbu Exp $ */ +/* $Id: php_imap.c,v 1.42 2000/08/18 16:02:27 chagenbu Exp $ */ #define IMAP41 @@ -3385,6 +3385,7 @@ int ind, ind_type, args; pils *imap_le_struct; long flags; + char *search_criteria; MESSAGELIST *cur; IMAPLS_FETCH(); @@ -3395,6 +3396,7 @@ convert_to_long_ex(streamind); convert_to_string_ex(criteria); + search_criteria = estrndup(Z_STRVAL_PP(criteria), Z_STRLEN_PP(criteria)); if (args == 2) { flags = SE_FREE; @@ -3411,7 +3413,7 @@ } IMAPG(imap_messages) = NIL; - mail_search_full(imap_le_struct->imap_stream, NIL, mail_criteria(cpystr(Z_STRVAL_PP(criteria))), flags); + mail_search_full(imap_le_struct->imap_stream, NIL, mail_criteria(search_criteria), flags); if (IMAPG(imap_messages) == NIL) { RETURN_FALSE; } @@ -3423,6 +3425,7 @@ cur = cur->next; } mail_free_messagelist(&IMAPG(imap_messages)); + efree(search_criteria); } /* }}} */

« previous php.cvs (#1225) next »