[syslinux] extlinux 6.03 serial console not responding to input

Andrew J. Schorr aschorr at telemetry-investments.com
Wed May 20 07:44:09 PDT 2015


On Wed, May 20, 2015 at 06:34:09AM -0700, Patrick Masotta wrote:
> Your patch considers only a very particular case.
> A systematic approach for "correctly" parsing a configuration file is not so simple.
> It minimally requires a regular expression parser for format error detection plus
> conversion & boundary checking when necessary. AFAIK this is not implemented yet;

I don't think it's quite so complicated.  I haven't reviewed the entire
function, but consider this simple patch to the section that handles
the "serial" command:

--- readconfig.c.orig	2015-05-20 10:37:57.877086549 -0400
+++ readconfig.c	2015-05-20 10:42:41.062052203 -0400
@@ -1313,8 +1313,13 @@ static void parse_config_file(FILE * f)
 		p = skipspace(p + 6);
 		port = strtoul(p, &p, 0);
 
-		while (isalnum(*p))
+		if (isalnum(*p)) {
+			ERROR: port token not consumed
+			do {
 			p++;
+
+			} while (isalnum(*p));
+		}
 		p = skipspace(p);
 
 		/* Default to no flow control */
@@ -1326,16 +1331,23 @@ static void parse_config_file(FILE * f)
 			uint8_t ignore;
 
 			/* setup baud */
-			baud = atoi(p);
-			while (isalnum(*p))
+			baud = strtoul(p, &p, 10);
+			if (isalnum(*p)) {
+				ERROR: baud token not consumed
+				do {
 				p++;
+				} while (isalnum(*p));
+			}
 			p = skipspace(p);
 
 			ignore = 0;
 			flow = 0;
 			if (isalnum(*p)) {
 				/* flow control */
-				flow = strtoul(p, NULL, 0);
+				flow = strtoul(p, &p, 0);
+				p = skipspace(p);
+				if (isalnum(*p))
+					ERROR: trailing junk detected
 				ignore = ((flow & 0x0F00) >> 4);
 			}
 
I just don't know what to do where it says ERROR.  How do we communicate
the error condition?

I imagine that similar error checking could be added for most of the
configuration file directives.

Regards,
Andy


More information about the Syslinux mailing list