Commit 71b67659 authored by Dan Winship's avatar Dan Winship

dhcp: fix systemd-dhcp's writing of routes in lease file

inet_ntoa() uses a static buffer, so you can't call it twice in the
same fprintf() call.

https://bugs.freedesktop.org/show_bug.cgi?id=86438
parent 44eb50d1
......@@ -404,10 +404,12 @@ void serialize_dhcp_routes(FILE *f, const char *key, struct sd_dhcp_route *route
fprintf(f, "%s=", key);
for (i = 0; i < size; i++)
fprintf(f, "%s/%" PRIu8 ",%s%s", inet_ntoa(routes[i].dst_addr),
routes[i].dst_prefixlen, inet_ntoa(routes[i].gw_addr),
for (i = 0; i < size; i++) {
fprintf(f, "%s/%" PRIu8, inet_ntoa(routes[i].dst_addr),
routes[i].dst_prefixlen);
fprintf(f, ",%s%s", inet_ntoa(routes[i].gw_addr),
(i < (size - 1)) ? " ": "");
}
fputs("\n", f);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment