projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
06a0790
)
network: add malloc-assertion in test
author
David Herrmann
<dh.herrmann@gmail.com>
Wed, 31 Dec 2014 14:54:20 +0000
(15:54 +0100)
committer
David Herrmann
<dh.herrmann@gmail.com>
Wed, 31 Dec 2014 14:55:10 +0000
(15:55 +0100)
Make sure malloc() really returns non-NULL in lldp test.
src/libsystemd-network/test-lldp.c
patch
|
blob
|
history
diff --git
a/src/libsystemd-network/test-lldp.c
b/src/libsystemd-network/test-lldp.c
index
e9d5d7b
..
288aac5
100644
(file)
--- a/
src/libsystemd-network/test-lldp.c
+++ b/
src/libsystemd-network/test-lldp.c
@@
-144,6
+144,7
@@
static int lldp_parse_port_id_tlv(tlv_packet *m) {
assert_se(tlv_packet_read_string(m, &str, &length) >= 0);
p = malloc0(length + 1);
+ assert_se(p);
strncpy(p, str, length-1);
assert_se(streq(p, TEST_LLDP_PORT) == 1);
@@
-182,6
+183,7
@@
static int lldp_parse_system_desc_tlv(tlv_packet *m) {
assert_se(tlv_packet_read_string(m, &str, &length) >= 0);
p = malloc0(length + 1);
+ assert_se(p);
strncpy(p, str, length);
assert_se(streq(p, TEST_LLDP_TYPE_SYSTEM_DESC) == 1);