Skip to content

Commit 8e77ef5

Browse files
Tomasz BursztykaAnas Nashif
authored andcommitted
tests/zoap: Fix possible NULL pointer dereference
Coverity-CID: 173648 Jira: ZEP-2535 Signed-off-by: Tomasz Bursztyka <[email protected]>
1 parent d9af77b commit 8e77ef5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/net/lib/zoap/src/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,9 @@ static int server_resource_1_get(struct zoap_resource *resource,
678678
resource->age);
679679

680680
p = zoap_packet_get_payload(&response, &len);
681-
memcpy(p, payload, sizeof(payload));
681+
if (p) {
682+
memcpy(p, payload, sizeof(payload));
683+
}
682684

683685
r = zoap_packet_set_used(&response, sizeof(payload));
684686
if (r < 0) {

0 commit comments

Comments
 (0)