diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2013-11-05 00:48:24 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-11-20 01:06:31 +0100 |
commit | fb19f64d6188e9baeba938d7c64ec99cc06f1162 (patch) | |
tree | 1ec0e3cb69706d737154748850831ced82adaa14 /tools | |
parent | a3a8c029ba77e16730b366e084444c9a393cfe92 (diff) | |
download | neard-fb19f64d6188e9baeba938d7c64ec99cc06f1162.tar.gz neard-fb19f64d6188e9baeba938d7c64ec99cc06f1162.tar.bz2 neard-fb19f64d6188e9baeba938d7c64ec99cc06f1162.zip |
nfctool: Fix snep-decode potential overflow
Code review done by Sebastian Krahmer <krahmer@suse.de>.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/nfctool/snep-decode.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/nfctool/snep-decode.c b/tools/nfctool/snep-decode.c index 27d3c1e..bee06e5 100644 --- a/tools/nfctool/snep-decode.c +++ b/tools/nfctool/snep-decode.c @@ -159,6 +159,8 @@ static int snep_decode_info(struct sniffer_packet *packet) } frag = g_malloc(sizeof(struct snep_frag)); + if (!frag) + return -ENOMEM; frag->count = 1; @@ -167,6 +169,8 @@ static int snep_decode_info(struct sniffer_packet *packet) frag->received = packet->snep.real_len; frag->buffer = g_malloc0(frag->buffer_size); + if (!frag->buffer) + return -ENOMEM; memcpy(frag->buffer, packet->snep.data, packet->snep.real_len); |