forked from pool/gsoap
Jan Engelhardt
4b3190a00d
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/gsoap?expand=0&rev=35
32 lines
791 B
Diff
32 lines
791 B
Diff
From: Jan Engelhardt <jengelh@medozas.de>
|
|
Date: 2011-07-01 17:19:00 +0200
|
|
|
|
src: fix invocation of undefined behavior
|
|
|
|
The int type may have a stricter alignment than buf, and as such,
|
|
using *(int *)buf is prone to undefined behavior, usually manifesting
|
|
themselves in SIGBUS.
|
|
|
|
---
|
|
gsoap/stdsoap2.c | 4 +++-
|
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
Index: gsoap-2.8.21/gsoap/stdsoap2.c
|
|
===================================================================
|
|
--- gsoap-2.8.21.orig/gsoap/stdsoap2.c
|
|
+++ gsoap-2.8.21/gsoap/stdsoap2.c
|
|
@@ -3073,10 +3073,12 @@ int
|
|
SOAP_FMAC2
|
|
soap_rand()
|
|
{ unsigned char buf[4];
|
|
+ int r;
|
|
if (!soap_ssl_init_done)
|
|
soap_ssl_init();
|
|
RAND_pseudo_bytes(buf, 4);
|
|
- return *(int*)buf;
|
|
+ memcpy(&r, buf, sizeof(r));
|
|
+ return r;
|
|
}
|
|
#endif
|
|
#endif
|