diff options
author | Michael Santos <[email protected]> | 2010-10-05 16:47:52 -0400 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2010-10-06 15:04:13 +0200 |
commit | 98a1edfa08dea2a7509415ecd8b2e4d283573c25 (patch) | |
tree | 763f54701024ebcb5c0db082f270d4d8bc15e9cb /lib/erl_interface/src/registry/reg_dump.c | |
parent | d8f8eeba477fd8872f1136fc507fa299f013cc46 (diff) | |
download | otp-98a1edfa08dea2a7509415ecd8b2e4d283573c25.tar.gz otp-98a1edfa08dea2a7509415ecd8b2e4d283573c25.tar.bz2 otp-98a1edfa08dea2a7509415ecd8b2e4d283573c25.zip |
registry: fix zero byte allocation
Pasto in code results in 0 bytes (instead of length bytes) being allocated
when the length of the key exceeds the static buffer.
Diffstat (limited to 'lib/erl_interface/src/registry/reg_dump.c')
-rw-r--r-- | lib/erl_interface/src/registry/reg_dump.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/erl_interface/src/registry/reg_dump.c b/lib/erl_interface/src/registry/reg_dump.c index 50a6949177..dfec96b43c 100644 --- a/lib/erl_interface/src/registry/reg_dump.c +++ b/lib/erl_interface/src/registry/reg_dump.c @@ -157,7 +157,7 @@ static int mn_send_delete(int fd, erlang_pid *mnesia, const char *key) int len = strlen(key) + 32; /* 32 is a slight overestimate */ if (len > EISMALLBUF) - if (!(dbuf = malloc(index))) + if (!(dbuf = malloc(len))) return -1; msgbuf = (dbuf ? dbuf : sbuf); @@ -187,7 +187,7 @@ static int mn_send_write(int fd, erlang_pid *mnesia, const char *key, ei_reg_obj int len = 32 + keylen + obj->size; if (len > EISMALLBUF) - if (!(dbuf = malloc(index))) + if (!(dbuf = malloc(len))) return -1; msgbuf = (dbuf ? dbuf : sbuf); |