iliaa           Mon Feb  7 17:31:57 2005 EDT

  Modified files:              (Branch: PHP_5_0)
    /php-src/ext/sysvmsg        sysvmsg.c 
    /php-src    NEWS 
  Log:
  MFH: Fixed bug #31527 (crash in msg_send() when non-string is stored without
  being serialized).
  
  
http://cvs.php.net/diff.php/php-src/ext/sysvmsg/sysvmsg.c?r1=1.16.2.2&r2=1.16.2.3&ty=u
Index: php-src/ext/sysvmsg/sysvmsg.c
diff -u php-src/ext/sysvmsg/sysvmsg.c:1.16.2.2 
php-src/ext/sysvmsg/sysvmsg.c:1.16.2.3
--- php-src/ext/sysvmsg/sysvmsg.c:1.16.2.2      Mon Jan 24 17:23:35 2005
+++ php-src/ext/sysvmsg/sysvmsg.c       Mon Feb  7 17:31:56 2005
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: sysvmsg.c,v 1.16.2.2 2005/01/24 22:23:35 iliaa Exp $ */
+/* $Id: sysvmsg.c,v 1.16.2.3 2005/02/07 22:31:56 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -142,7 +142,7 @@
 {
        php_info_print_table_start();
        php_info_print_table_row(2, "sysvmsg support", "enabled");
-       php_info_print_table_row(2, "Revision", "$Revision: 1.16.2.2 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.16.2.3 $");
        php_info_print_table_end();
 }
 /* }}} */
@@ -391,10 +391,33 @@
                message_len = msg_var.len;
                smart_str_free(&msg_var);
        } else {
-               convert_to_string_ex(&message);
-               messagebuffer = emalloc(sizeof(struct php_msgbuf) + 
Z_STRLEN_P(message));
-               memcpy(messagebuffer->mtext, Z_STRVAL_P(message), 
Z_STRLEN_P(message) + 1);
-               message_len = Z_STRLEN_P(message);
+               char *p;
+               switch (Z_TYPE_P(message)) {
+                       case IS_STRING:
+                               p = Z_STRVAL_P(message);
+                               message_len = Z_STRLEN_P(message);
+                               break;
+
+                       case IS_LONG:
+                       case IS_BOOL:
+                               message_len = spprintf(&p, 0, "%ld", 
Z_LVAL_P(message));
+                               break;
+
+                       case IS_DOUBLE:
+                               message_len = spprintf(&p, 0, "%f", 
Z_DVAL_P(message));
+                               break;
+
+                       default:
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Message parameter must be either a string or a number.");
+                               RETURN_FALSE;
+               }
+
+               messagebuffer = emalloc(sizeof(struct php_msgbuf) + 
message_len);
+               memcpy(messagebuffer->mtext, p, message_len + 1);
+
+               if (Z_TYPE_P(message) != IS_STRING) {
+                       efree(p);
+               }
        }
        
        /* set the message type */
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1760.2.238&r2=1.1760.2.239&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1760.2.238 php-src/NEWS:1.1760.2.239
--- php-src/NEWS:1.1760.2.238   Mon Feb  7 08:31:40 2005
+++ php-src/NEWS        Mon Feb  7 17:31:57 2005
@@ -42,6 +42,8 @@
   (Marcus)
 - Fixed bug #31623 (OCILogin does not support password grace period).
   (daniel dot beet at accuratesoftware dot com, Tony)
+- Fixed bug #31527 (crash in msg_send() when non-string is stored without
+  being serialized). (Ilia)
 - Fixed bug #31514 (open_basedir uses path_translated rather then cwd for .
   translation). (Ilia)
 - Fixed bug #31480 (Possible infinite loop in imap_mail_compose()). (Ilia)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to