[syslinux] extlinux 6.03 serial console not responding to input

Andrew J. Schorr aschorr at telemetry-investments.com
Tue May 19 20:42:32 PDT 2015


On Wed, May 20, 2015 at 04:43:32AM +0300, Ady via Syslinux wrote:
> > How far such a backward compatibility fix should go?
>  
> A configuration file containing the following (1st) line (as example):
> 
>  SERIAL 0 115200 0x003
> 
> and/or the following:
> 
>  SERIAL 1 115200
> 
> and/or:
> 
>  SERIAL 0x3F8 115200
> 
> and/or any other documented syntax for the SERIAL directive should be 
> supported in the next Syslinux release, and patches are welcome (better 
> sooner rather than later :).
> 
> In other words, this is a regression bug, and AFAIK there was no 
> intention to drop support of non-decimal values for the SERIAL 
> directive.
> 
> Again, patches are welcome.

This is completely untested, but something like the attached (where 'atoi'
is replaced by 'strntoumax(nptr, (char **)NULL, 0, ~(size_t) 0)') might
do the trick.  The current 'atoi' calls translate to
   (int) strntoumax(nptr, (char **)NULL, 10, ~(size_t) 0);
The problem is that they specify base 10.  If the base is left as 0,
then strntoumax will recognize hex values starting with '0x' and
octal values starting with '0'.  Is baudrate required to be in base10?

Note that this patch does not allow the other funky formats in the old
assembly 'getint' call.  The parseint comment says:

;               Syntaxes accepted: [-]dec, [-]0+oct, [-]0x+hex, val+[KMG]

So if you want to support that last syntax, it wil require further work.

Regards,
Andy
-------------- next part --------------
diff --git a/com32/elflink/ldlinux/readconfig.c b/com32/elflink/ldlinux/readconfig.c
index 347f826..13f6e23 100644
--- a/com32/elflink/ldlinux/readconfig.c
+++ b/com32/elflink/ldlinux/readconfig.c
@@ -1311,7 +1311,7 @@ static void parse_config_file(FILE * f)
 		uint32_t baud;
 
 		p = skipspace(p + 6);
-		port = atoi(p);
+		port = strntoumax(p, (char **)NULL, 0, ~(size_t) 0);
 
 		while (isalnum(*p))
 			p++;
@@ -1335,7 +1335,7 @@ static void parse_config_file(FILE * f)
 			flow = 0;
 			if (isalnum(*p)) {
 				/* flow control */
-				flow = atoi(p);
+				flow = strntoumax(p, (char **)NULL, 0, ~(size_t) 0);
 				ignore = ((flow & 0x0F00) >> 4);
 			}
 


More information about the Syslinux mailing list