]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/libsystemd/sd-resolve/sd-resolve.c
sd-resolve: workaround for structured initialization to nested structs 9747/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 29 Jul 2018 07:04:56 +0000 (16:04 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 29 Jul 2018 07:05:23 +0000 (16:05 +0900)
commitb127bc99d13cede3b1ba6bd8acd936ff7a0d2f31
treeb92baa53e2e9e759893f0ab676ad6f82036d32a4
parent2a12960bcdb90638bf28da237f89383bdd19b344
sd-resolve: workaround for structured initialization to nested structs

When a nested struct is initialized by structured initializer, then
padding space is not cleared by zero. So, before setting values,
this makes explicitly set zero including padding.

This fixes the following false positive warning by valgrind:
```
==492== Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s)
==492==    at 0x56D0CF7: sendmsg (in /usr/lib64/libpthread-2.27.so)
==492==    by 0x4FDD3C5: sd_resolve_getaddrinfo (sd-resolve.c:975)
==492==    by 0x110B9E: manager_connect (timesyncd-manager.c:879)
==492==    by 0x10B729: main (timesyncd.c:165)
==492==  Address 0x1fff0008f1 is on thread 1's stack
==492==  in frame #1, created by sd_resolve_getaddrinfo (sd-resolve.c:928)
==492==
```
src/libsystemd/sd-resolve/sd-resolve.c