[PHP-DEV] cvs: /php3/functions imap.c From: Andrew Skalski (askalski <email protected>)
Date: 01/28/00

askalski Fri Jan 28 11:51:18 2000 EDT

  Modified files:
    /php3/functions imap.c
  Log:
  null-terminate strings returned by imap_utf7_decode/encode
  
  
Index: php3/functions/imap.c
diff -u php3/functions/imap.c:1.80 php3/functions/imap.c:1.81
--- php3/functions/imap.c:1.80 Tue Jan 18 11:48:47 2000
+++ php3/functions/imap.c Fri Jan 28 11:51:18 2000
@@ -33,7 +33,7 @@
    | Andrew Skalski <askalski <email protected>> |
    +----------------------------------------------------------------------+
  */
-/* $Id: imap.c,v 1.80 2000/01/18 19:48:47 askalski Exp $ */
+/* $Id: imap.c,v 1.81 2000/01/28 19:51:18 askalski Exp $ */
 
 #define IMAP41
 
@@ -2625,7 +2625,7 @@
         }
 
         /* allocate output buffer */
- if ((out = emalloc(outlen)) == NULL) {
+ if ((out = emalloc(outlen + 1)) == NULL) {
                 php3_error(E_WARNING, "imap_utf7_decode: "
                         "Unable to allocate result string");
                 RETURN_FALSE;
@@ -2673,6 +2673,8 @@
                 }
         }
 
+ *outp = 0;
+
 #if DEBUG
         /* warn if we computed outlen incorrectly */
         if (outp - out != outlen) {
@@ -2746,7 +2748,7 @@
         }
 
         /* allocate output buffer */
- if ((out = emalloc(outlen)) == NULL) {
+ if ((out = emalloc(outlen + 1)) == NULL) {
                 php3_error(E_WARNING, "imap_utf7_encode: "
                         "Unable to allocate result string");
                 RETURN_FALSE;
@@ -2796,6 +2798,8 @@
                         }
                 }
         }
+
+ *outp = 0;
 
 #if DEBUG
         /* warn if we computed outlen incorrectly */

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>