commit a0b5db9: [Fix] Do not trust stat(2) it lies

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Feb 25 19:42:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-02-25 19:39:55 +0000
URL: https://github.com/rspamd/rspamd/commit/a0b5db928fa1e0a6653d97569ee0485093ac6d72

[Fix] Do not trust stat(2) it lies
Issue: #3254

---
 src/libutil/addr.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/libutil/addr.c b/src/libutil/addr.c
index 4a540fefc..1beeb421e 100644
--- a/src/libutil/addr.c
+++ b/src/libutil/addr.c
@@ -162,13 +162,7 @@ rspamd_ip_check_ipv6 (void)
 
 			if (stat ("/proc/net/dev", &st) != -1) {
 				if (stat ("/proc/net/if_inet6", &st) != -1) {
-					if (st.st_size != 0) {
-						ipv6_status = RSPAMD_IPV6_SUPPORTED;
-					}
-					else {
-						/* Empty file, no ipv6 configuration at all */
-						ipv6_status = RSPAMD_IPV6_UNSUPPORTED;
-					}
+					ipv6_status = RSPAMD_IPV6_SUPPORTED;
 				}
 				else {
 					ipv6_status = RSPAMD_IPV6_UNSUPPORTED;


More information about the Commits mailing list