Skip to content

Commit 96c256d

Browse files
mctpd: zero initialize link data
On non-bus-owner modes, link->slot_busowner will be uninitialized, leading to segmentation fault when running sd_bus_slot_unref. ==3850684== Conditional jump or move depends on uninitialised value(s) ==3850684== at 0x48FB448: sd_bus_slot_unref (in /usr/lib/aarch64-linux-gnu/libsystemd.so.0.38.0) ==3850684== by 0x1123E3: free_link (mctpd.c:3263) ==3850684== by 0x1125CB: free_links (mctpd.c:3308) ==3850684== by 0x113D63: main (mctpd.c:3900) Simply zero initialize the link data. Signed-off-by: Khang D Nguyen <[email protected]>
1 parent ee23fcf commit 96c256d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mctpd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3573,7 +3573,7 @@ static int add_interface(struct ctx *ctx, int ifindex)
35733573
return -ENOENT;
35743574
}
35753575

3576-
struct link *link = malloc(sizeof(*link));
3576+
struct link *link = calloc(sizeof(*link), 1);
35773577
if (!link)
35783578
return -ENOMEM;
35793579

0 commit comments

Comments
 (0)