Blame SOURCES/autofs-5.1.6-fix-quoted-string-length-calc-in-expandsunent.patch

b2d21a
autofs-5.1.6 - fix quoted string length calc in expandsunent()
b2d21a
b2d21a
From: Ian Kent <raven@themaw.net>
b2d21a
b2d21a
The expandsunent() function in modules/parse_sun.c fails to properly
b2d21a
handle the ending " in a quoted string causing the length calculation
b2d21a
to not account for the ending quote and also doesn't properly account
b2d21a
for the remainder of the string being expanded.
b2d21a
b2d21a
Also, when called again (after being called to get the length) the
b2d21a
allocated buffer is too small leading to out of bounds accesses.
b2d21a
b2d21a
Signed-off-by: Ian Kent <raven@themaw.net>
b2d21a
---
b2d21a
 CHANGELOG           |    1 +
b2d21a
 modules/parse_sun.c |    6 ++++--
b2d21a
 2 files changed, 5 insertions(+), 2 deletions(-)
b2d21a
b2d21a
--- autofs-5.1.4.orig/CHANGELOG
b2d21a
+++ autofs-5.1.4/CHANGELOG
b2d21a
@@ -79,6 +79,7 @@ xx/xx/2018 autofs-5.1.5
b2d21a
 - fix a regression with map instance lookup.
b2d21a
 - fix trailing dollar sun entry expansion.
b2d21a
 - initialize struct addrinfo for getaddrinfo() calls.
b2d21a
+- fix quoted string length calc in expandsunent().
b2d21a
 
b2d21a
 19/12/2017 autofs-5.1.4
b2d21a
 - fix spec file url.
b2d21a
--- autofs-5.1.4.orig/modules/parse_sun.c
b2d21a
+++ autofs-5.1.4/modules/parse_sun.c
b2d21a
@@ -213,9 +213,11 @@ int expandsunent(const char *src, char *
b2d21a
 					*dst++ = *src;
b2d21a
 				src++;
b2d21a
 			}
b2d21a
-			if (*src && dst) {
b2d21a
+			if (*src) {
b2d21a
 				len++;
b2d21a
-				*dst++ = *src++;
b2d21a
+				if (dst)
b2d21a
+					*dst++ = *src;
b2d21a
+				src++;
b2d21a
 			}
b2d21a
 			break;
b2d21a