aboutsummaryrefslogtreecommitdiff
path: root/support/support_chroot.c
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2025-02-12 19:46:06 +0100
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2025-02-13 16:31:28 -0300
commit6a3cb6b1bd63e167fc525cce07010ff78197b271 (patch)
tree7fcc3d2f846503b5ee993096c0ad6212aa0cdc2c /support/support_chroot.c
parent991febc2f46d51801691bbd489d290820728d241 (diff)
downloadglibc-6a3cb6b1bd63e167fc525cce07010ff78197b271.tar.xz
glibc-6a3cb6b1bd63e167fc525cce07010ff78197b271.zip
nss: Improve network number parsers (bz 32573, 32575)
Make sure that numbers never overflow uint32_t in inet_network to properly validate octets encountered in IPv4 addresses. Avoid malloca in NSS networks file code because /etc/networks lines can be arbitrarily long. Instead of handcrafting the input for inet_network by adding ".0" octets if they are missing, just left shift the result. Also, do not accept invalid entries, but ignore the line instead. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Diffstat (limited to 'support/support_chroot.c')
-rw-r--r--support/support_chroot.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/support/support_chroot.c b/support/support_chroot.c
index 2637dd1522..92c2a453aa 100644
--- a/support/support_chroot.c
+++ b/support/support_chroot.c
@@ -57,6 +57,7 @@ support_chroot_create (struct support_chroot_configuration conf)
write_file (path_etc, "hosts", conf.hosts, &chroot->path_hosts);
write_file (path_etc, "host.conf", conf.host_conf, &chroot->path_host_conf);
write_file (path_etc, "aliases", conf.aliases, &chroot->path_aliases);
+ write_file (path_etc, "networks", conf.networks, &chroot->path_networks);
free (path_etc);
@@ -79,5 +80,6 @@ support_chroot_free (struct support_chroot *chroot)
free (chroot->path_hosts);
free (chroot->path_host_conf);
free (chroot->path_aliases);
+ free (chroot->path_networks);
free (chroot);
}