diff options
author | Lukas Larsson <[email protected]> | 2015-08-14 11:51:21 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2015-12-15 10:05:45 +0100 |
commit | 898ca7f86dff3fe21c9bf2e5018c7fb93dca158e (patch) | |
tree | bcef30e7264c380d296e28d3d13b99286143cfec /erts/emulator | |
parent | d5f541904839b0307b1db3a28aace3ea6ba2fd37 (diff) | |
download | otp-898ca7f86dff3fe21c9bf2e5018c7fb93dca158e.tar.gz otp-898ca7f86dff3fe21c9bf2e5018c7fb93dca158e.tar.bz2 otp-898ca7f86dff3fe21c9bf2e5018c7fb93dca158e.zip |
erts: Fix dereferencing of unaligned integer for sparc
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/sys/unix/erl_child_setup.c | 12 | ||||
-rw-r--r-- | erts/emulator/sys/unix/sys_drivers.c | 3 |
2 files changed, 9 insertions, 6 deletions
diff --git a/erts/emulator/sys/unix/erl_child_setup.c b/erts/emulator/sys/unix/erl_child_setup.c index 71c7948bf0..8bec36be60 100644 --- a/erts/emulator/sys/unix/erl_child_setup.c +++ b/erts/emulator/sys/unix/erl_child_setup.c @@ -133,8 +133,8 @@ start_new_child(int pipes[]) o_buff = buff; - flags = *(int*)buff; - buff += sizeof(int); + flags = get_int32(buff); + buff += sizeof(Sint32); DEBUG_PRINT("flags = %d", flags); @@ -150,8 +150,8 @@ start_new_child(int pipes[]) DEBUG_PRINT("wd = %s", wd); - cnt = *(int*)buff; - buff += sizeof(int); + cnt = get_int32(buff); + buff += sizeof(Sint32); new_environ = malloc(sizeof(char*)*(cnt + 1)); for (i = 0; i < cnt; i++, buff++) { @@ -162,8 +162,8 @@ start_new_child(int pipes[]) if (o_buff + size != buff) { /* This is a spawn executable call */ - cnt = *(int*)buff; - buff += sizeof(int); + cnt = get_int32(buff); + buff += sizeof(Sint32); args = malloc(sizeof(char*)*(cnt + 1)); for (i = 0; i < cnt; i++, buff++) { args[i] = buff; diff --git a/erts/emulator/sys/unix/sys_drivers.c b/erts/emulator/sys/unix/sys_drivers.c index 8402197924..97a9c3dfaa 100644 --- a/erts/emulator/sys/unix/sys_drivers.c +++ b/erts/emulator/sys/unix/sys_drivers.c @@ -699,6 +699,7 @@ static ErlDrvData spawn_start(ErlDrvPort port_num, char* name, io_vector[i++].iov_len = sizeof(buffsz); io_vector[i].iov_base = (void*)&flags; + flags = htonl(flags); io_vector[i++].iov_len = sizeof(flags); buffsz += sizeof(flags); @@ -715,6 +716,7 @@ static ErlDrvData spawn_start(ErlDrvPort port_num, char* name, buffsz += io_vector[i-1].iov_len; io_vector[i].iov_base = (void*)&env_len; + env_len = htonl(env_len); io_vector[i++].iov_len = sizeof(env_len); buffsz += io_vector[i-1].iov_len; @@ -728,6 +730,7 @@ static ErlDrvData spawn_start(ErlDrvPort port_num, char* name, if (opts->spawn_type == ERTS_SPAWN_EXECUTABLE) { io_vector[i].iov_base = (void*)&argv_len; + argv_len = htonl(argv_len); io_vector[i++].iov_len = sizeof(argv_len); buffsz += io_vector[i-1].iov_len; |