Gitweb:
https://git.exim.org/exim.git/commitdiff/f8d78f744328266ad9f7f48cf5ca8f7d67c227c4
Commit: f8d78f744328266ad9f7f48cf5ca8f7d67c227c4
Parent: 6d5f5cafb4c507abe36434bf7695573284eb8761
Author: Jeremy Harris <jgh146exb@???>
AuthorDate: Thu Jul 25 19:41:57 2019 +0100
Committer: Jeremy Harris <jgh146exb@???>
CommitDate: Thu Jul 25 19:41:57 2019 +0100
De-taint library-return string for inet_ntoa() etc
---
src/src/host.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/src/host.c b/src/src/host.c
index a00d048..30d54b4 100644
--- a/src/src/host.c
+++ b/src/src/host.c
@@ -945,13 +945,15 @@ else
/* If there is no buffer, put the string into some new store. */
-if (buffer == NULL) return string_copy(yield);
+if (!buffer) buffer = store_get(46, FALSE);
/* Callers of this function with a non-NULL buffer must ensure that it is
large enough to hold an IPv6 address, namely, at least 46 bytes. That's what
-makes this use of strcpy() OK. */
+makes this use of strcpy() OK.
+If the library returned apparently an apparently tainted string, clean it;
+we trust IP addresses. */
-Ustrcpy(buffer, yield);
+string_format_nt(buffer, 46, "%s", yield);
return buffer;
}