summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_net.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2010-07-15 16:57:14 +0000
committerAndrey Hristov <andrey@php.net>2010-07-15 16:57:14 +0000
commita30113b617e98eabe94b02b4fa82387d462a4f8c (patch)
treeaf103444aaa65d98d6d605a1957297ce2805c342 /ext/mysqlnd/mysqlnd_net.c
parent1dc9e43cd03bf482effae8c10690fa5177bdc288 (diff)
downloadphp-git-a30113b617e98eabe94b02b4fa82387d462a4f8c.tar.gz
Fix for Bug #51583 Bus error due to wrong alignment in mysqlnd
Diffstat (limited to 'ext/mysqlnd/mysqlnd_net.c')
-rw-r--r--ext/mysqlnd/mysqlnd_net.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c
index 016a2f10fe..207fa53f0c 100644
--- a/ext/mysqlnd/mysqlnd_net.c
+++ b/ext/mysqlnd/mysqlnd_net.c
@@ -199,7 +199,12 @@ MYSQLND_METHOD(mysqlnd_net, connect)(MYSQLND_NET * net, const char * const schem
/* We assume that MYSQLND_HEADER_SIZE is 4 bytes !! */
-#define STORE_HEADER_SIZE(safe_storage, buffer) int4store((safe_storage), (*(uint32_t *)(buffer)))
+#define COPY_HEADER(T,A) do { \
+ *(((char *)(T))) = *(((char *)(A)));\
+ *(((char *)(T))+1) = *(((char *)(A))+1);\
+ *(((char *)(T))+2) = *(((char *)(A))+2);\
+ *(((char *)(T))+3) = *(((char *)(A))+3); } while (0)
+#define STORE_HEADER_SIZE(safe_storage, buffer) COPY_HEADER((safe_storage), (buffer))
#define RESTORE_HEADER_SIZE(buffer, safe_storage) STORE_HEADER_SIZE((safe_storage), (buffer))
/* {{{ mysqlnd_net::send */