diff options
author | Sverker Eriksson <[email protected]> | 2019-01-28 17:36:31 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2019-01-28 19:43:24 +0100 |
commit | ad5822c6b1401111bbdbc5e77fe097a3f1b2b3cb (patch) | |
tree | 2d8520bde623c7aeb6812f4fe63a597467812e79 /erts/emulator/drivers/common/inet_drv.c | |
parent | a4aeacd28e4e31d3d79b091afcdc528082be2865 (diff) | |
download | otp-ad5822c6b1401111bbdbc5e77fe097a3f1b2b3cb.tar.gz otp-ad5822c6b1401111bbdbc5e77fe097a3f1b2b3cb.tar.bz2 otp-ad5822c6b1401111bbdbc5e77fe097a3f1b2b3cb.zip |
erts: Add magic port control numbers
to increase the probablity of a nice badarg
from erlang:port_control.
Diffstat (limited to 'erts/emulator/drivers/common/inet_drv.c')
-rw-r--r-- | erts/emulator/drivers/common/inet_drv.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c index ed687b8d70..a6a5c20266 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -9955,6 +9955,7 @@ static ErlDrvSSizeT tcp_inet_ctl(ErlDrvData e, unsigned int cmd, { tcp_descriptor* desc = (tcp_descriptor*)e; + cmd -= ERTS_INET_DRV_CONTROL_MAGIC_NUMBER; switch(cmd) { case INET_REQ_OPEN: { /* open socket and return internal index */ int domain; @@ -12184,6 +12185,7 @@ static ErlDrvSSizeT packet_inet_ctl(ErlDrvData e, unsigned int cmd, char* buf, int type = SOCK_DGRAM; int af = AF_INET; + cmd -= ERTS_INET_DRV_CONTROL_MAGIC_NUMBER; switch(cmd) { case INET_REQ_OPEN: /* open socket and return internal index */ DEBUGF(("packet_inet_ctl(%ld): OPEN\r\n", (long)desc->port)); |