Blame SOURCES/autofs-5.0.7-add-null-check-in-read_one.patch

4d476f
autofs-5.0.7 - add null check in read_one()
4d476f
4d476f
From: Ian Kent <raven@themaw.net>
4d476f
4d476f
The pointter p shouldn't be null here but add a chack anyway.
4d476f
---
4d476f
 modules/lookup_file.c |    6 ++++--
4d476f
 1 file changed, 4 insertions(+), 2 deletions(-)
4d476f
4d476f
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
4d476f
index 65e5ee6..2836996 100644
4d476f
--- a/modules/lookup_file.c
4d476f
+++ b/modules/lookup_file.c
4d476f
@@ -302,8 +302,10 @@ static int read_one(unsigned logopt, FILE *f, char *key, unsigned int *k_len, ch
4d476f
 				if (gotten == got_real || gotten == getting)
4d476f
 					goto got_it;
4d476f
 			} else if (mapent_len < MAPENT_MAX_LEN) {
4d476f
-				mapent_len++;
4d476f
-				*(p++) = ch;
4d476f
+				if (p) {
4d476f
+					mapent_len++;
4d476f
+					*(p++) = ch;
4d476f
+				}
4d476f
 				nch = getc(f);
4d476f
 				if (nch == EOF &&
4d476f
 				   (gotten == got_real || gotten == getting))