autofs-5.0.3 - handle zero length nis key update
From: Ian Kent <raven@themaw.net>
A zero length key is invalid but so is a single character
non-printable key and it causes the parser to get confused
as well.
---
modules/lookup_yp.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c
index ee06551..8b6408b 100644
--- a/modules/lookup_yp.c
+++ b/modules/lookup_yp.c
@@ -19,6 +19,7 @@
#include <unistd.h>
#include <time.h>
#include <signal.h>
+#include <ctype.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -168,9 +169,13 @@ int yp_all_master_callback(int status, char *ypkey, int ypkeylen,
if (status != YP_TRUE)
return status;
- /* Ignore zero length keys */
- if (ypkeylen == 0)
+ /* Ignore zero length and single non-printable char keys */
+ if (ypkeylen == 0 || (ypkeylen == 1 && !isprint(*ypkey))) {
+ warn(logopt, MODPREFIX
+ "ignoring invalid map entry, zero length or "
+ "single character non-printable key");
return 0;
+ }
/*
* Ignore keys beginning with '+' as plus map
@@ -267,9 +272,13 @@ int yp_all_callback(int status, char *ypkey, int ypkeylen,
if (status != YP_TRUE)
return status;
- /* Ignore zero length keys */
- if (ypkeylen == 0)
+ /* Ignore zero length and single non-printable char keys */
+ if (ypkeylen == 0 || (ypkeylen == 1 && !isprint(*ypkey))) {
+ warn(logopt, MODPREFIX
+ "ignoring invalid map entry, zero length or "
+ "single character non-printable key");
return 0;
+ }
/*
* Ignore keys beginning with '+' as plus map