rpms/autofs/FC-5 autofs-4.1.4-bad-key-len-fix.patch, NONE, 1.1 autofs.spec, 1.81, 1.82

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Jun 19 08:43:41 UTC 2006


Author: ikent

Update of /cvs/dist/rpms/autofs/FC-5
In directory cvs.devel.redhat.com:/tmp/cvs-serv21994

Modified Files:
	autofs.spec 
Added Files:
	autofs-4.1.4-bad-key-len-fix.patch 
Log Message:
* Mon Jun 19 2006 Ian Kent <ikent at redhat.com> - 1:4.1.4-27
- Change LDAP message severity from crit to degug (bz# 183893).
- Add patch to ignore the "bg" and "fg" mount options as they
  aren't relevant for autofs mounts (bz# 184386).
- Add patch to fix key and mapent lenght check.


autofs-4.1.4-bad-key-len-fix.patch:
 lookup_file.c |   32 +++++++++++++++++++++++---------
 1 files changed, 23 insertions(+), 9 deletions(-)

--- NEW FILE autofs-4.1.4-bad-key-len-fix.patch ---
--- autofs-4.1.4/modules/lookup_file.c.bad-key-len-fix	2006-06-19 04:12:20.000000000 -0400
+++ autofs-4.1.4/modules/lookup_file.c	2006-06-19 04:33:55.000000000 -0400
@@ -99,7 +99,7 @@
 static int read_one(FILE *f, char *key, char *mapent)
 {
 	char *kptr, *p;
-	int mapent_len;
+	int mapent_len, key_len;
 	int ch, nch;
 	LOOKUP_STATE state;
 	FOUND_STATE getting, gotten;
@@ -107,7 +107,7 @@
 
 	kptr = key;
 	p = NULL;
-	mapent_len = 0;
+	mapent_len = key_len = 0;
 	state = st_begin;
 	memset(key, 0, KEY_MAX_LEN + 1);
 	memset(mapent, 0, MAPENT_MAX_LEN + 1);
@@ -147,9 +147,11 @@
 				else if (ch == '*') {
 					state = st_star;
 					*(kptr++) = ch;
+					key_len++;
 				} else {
 					state = st_compare;
 					*(kptr++) = ch;
+					key_len++;
 				}
 			} else if (escape == esc_char);
 			else
@@ -157,18 +159,24 @@
 			break;
 
 		case st_compare:
-			if (kptr - key > KEY_MAX_LEN) {
-				state = st_badent;
-				break;
-			}
 			if (ch == '\n')
 				state = st_begin;
 			else if (isspace(ch) && !escape) {
 				getting = got_real;
 				state = st_entspc;
 			} else if (escape == esc_char);
-			else
-				*(kptr++) = ch;
+			else {
+				if (key_len == KEY_MAX_LEN) {
+					state = st_badent;
+					error(MODPREFIX "Map key \"%s...\" "
+					      "is too long.  The maximum key "
+					      "length is %d", key,
+					      KEY_MAX_LEN);
+				} else {
+					*(kptr++) = ch;
+					key_len++;
+				}
+			}
 			break;
 
 		case st_star:
@@ -211,6 +219,12 @@
 				   (gotten == got_real || gotten == getting))
 				   	goto got_it;
 				ungetc(nch, f);
+			} else {
+				error(MODPREFIX "Map entry \"%s...\" for key "
+				      "\"%s\" is too long.  The maximum entry"
+				      " size is %d", mapent, key,
+				      MAPENT_MAX_LEN);
+				state = st_badent
 			}
 			break;
 		}
@@ -225,7 +239,7 @@
 	      next:
 		kptr = key;
 		p = NULL;
-		mapent_len = 0;
+		mapent_len = key_len = 0;
 		memset(key, 0, KEY_MAX_LEN + 1);
 		memset(mapent, 0, MAPENT_MAX_LEN + 1);
 		getting = gotten = got_nothing;


Index: autofs.spec
===================================================================
RCS file: /cvs/dist/rpms/autofs/FC-5/autofs.spec,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- autofs.spec	19 Jun 2006 07:13:42 -0000	1.81
+++ autofs.spec	19 Jun 2006 08:43:38 -0000	1.82
@@ -40,7 +40,8 @@
 Patch27: autofs-4.1.4-auto.smb-cifs.patch
 Patch28: autofs-4.1.4-get_best_mount-white-space.patch
 Patch29: autofs-4.1.4-discard-bg-nofg-options.patch
-Patch30:  autofs-4.1.4-no-first-message.patch
+Patch30: autofs-4.1.4-no-first-message.patch
+Patch31: autofs-4.1.4-bad-key-len-fix.patch
 
 Buildroot: /var/tmp/autofs-tmp
 BuildPrereq: autoconf, hesiod-devel, openldap-devel, perl
@@ -110,6 +111,7 @@
 %patch28 -p1
 %patch29 -p1
 %patch30 -p1
+%patch31 -p1
 
 %build
 #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -167,6 +169,7 @@
 - Change LDAP message severity from crit to degug (bz# 183893).
 - Add patch to ignore the "bg" and "fg" mount options as they
   aren't relevant for autofs mounts (bz# 184386).
+- Add patch to fix key and mapent lenght check.
 
 * Tue May 30 2006 Ian Kent <ikent at redhat.com> - 1:4.1.4-25
 - add patch to fix white space handling in get_best_mount




More information about the fedora-cvs-commits mailing list