void-packages/srcpkgs/glibc/patches/glibc-security-buflen.patch

15 lines
590 B
Diff

Taken from http://www.linuxfromscratch.org/lfs/view/development/chapter06/glibc.html
--- resolv/nss_dns/dns-host.c 2015-02-06 07:40:18.000000000 +0100
+++ resolv/nss_dns/dns-host.c 2015-04-25 17:38:58.365119958 +0200
@@ -615,7 +615,8 @@
int have_to_map = 0;
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data);
buffer += pad;
- if (__glibc_unlikely (buflen < sizeof (struct host_data) + pad))
+ buflen = buflen > pad ? buflen - pad : 0;
+ if (__glibc_unlikely (buflen < sizeof (struct host_data)))
{
/* The buffer is too small. */
too_small: