<p dir="ltr">What was broken? It worked fine in my testing.</p>
<div class="gmail_quote">On Mar 29, 2016 11:57 PM, "Chris Johns" <<a href="mailto:chrisj@rtems.org">chrisj@rtems.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
.../lib/libbsp/i386/pc386/console/console_select.c | 62 ++++++++++++++--------<br>
1 file changed, 41 insertions(+), 21 deletions(-)<br>
<br>
diff --git a/c/src/lib/libbsp/i386/pc386/console/console_select.c b/c/src/lib/libbsp/i386/pc386/console/console_select.c<br>
index 3fb31ec..7b40f97 100644<br>
--- a/c/src/lib/libbsp/i386/pc386/console/console_select.c<br>
+++ b/c/src/lib/libbsp/i386/pc386/console/console_select.c<br>
@@ -33,6 +33,8 @@<br>
#include <crt.h><br>
#endif<br>
<br>
+#include <bsp/bspimpl.h><br>
+<br>
/*<br>
* Forward prototype<br>
*/<br>
@@ -137,14 +139,19 @@ static void parse_com1_com4_enable(void)<br>
}<br>
}<br>
<br>
+extern char* bsp_boot_cmdline;<br>
+<br>
static bool parse_printk_or_console(<br>
const char *param,<br>
rtems_device_minor_number *minor_out<br>
)<br>
{<br>
- static const char *opt;<br>
- char working[64] = "";<br>
- char *p;<br>
+ static const char *opt;<br>
+ const char *option;<br>
+ const char *comma;<br>
+ size_t length;<br>
+ size_t index;<br>
+ rtems_device_minor_number minor;<br>
<br>
/*<br>
* Check the command line for the type of mode the console is.<br>
@@ -155,30 +162,43 @@ static bool parse_printk_or_console(<br>
}<br>
<br>
/*<br>
- * bsp_cmdline_arg() returns pointer to a string. It may not be the<br>
- * last string on the command line.<br>
+ * Fine the length, there can be more command line visible.<br>
*/<br>
- strncpy( working, opt, sizeof(working) );<br>
- p = strchr( working, ' ' );<br>
- if ( p ) {<br>
- *p = '\0';<br>
+ length = 0;<br>
+ while ((opt[length] != ' ') && (opt[length] != '\0')) {<br>
+ ++length;<br>
+ if (length > NAME_MAX) {<br>
+ printk("invalid option (%s): too long\n", param);<br>
+ return false;<br>
+ }<br>
}<br>
<br>
- const char *comma;<br>
- size_t length = NAME_MAX;<br>
- rtems_device_minor_number minor;<br>
- char *option = working;<br>
-<br>
/*<br>
* Only match up to a comma or NULL<br>
*/<br>
- comma = strchr (option, ',');<br>
+ index = 0;<br>
+ while ((opt[index] != '=') && (index < length)) {<br>
+ ++index;<br>
+ }<br>
+<br>
+ if (opt[index] != '=') {<br>
+ printk("invalid option (%s): no equals\n", param);<br>
+ return false;<br>
+ }<br>
+<br>
+ ++index;<br>
+ option = &opt[index];<br>
<br>
- if ( comma ) {<br>
- length = comma - option;<br>
+ while ((opt[index] != ',') && (index < length)) {<br>
+ ++index;<br>
}<br>
<br>
- option += strnlen(param, 32);<br>
+ if (opt[index] == ',')<br>
+ comma = &opt[index];<br>
+ else<br>
+ comma = NULL;<br>
+<br>
+ length = &opt[index] - option;<br>
<br>
if ( !bsp_find_console_entry( option, length, &minor ) ) {<br>
return false;<br>
@@ -186,10 +206,10 @@ static bool parse_printk_or_console(<br>
<br>
*minor_out = minor;<br>
if (comma) {<br>
- console_tbl *conscfg;<br>
+ console_tbl *conscfg = &Console_Configuration_Ports[minor];<br>
+<br>
+ option = comma + 1;<br>
<br>
- comma += 1;<br>
- conscfg = &Console_Configuration_Ports[minor];<br>
if (strncmp (option, "115200", sizeof ("115200") - 1) == 0)<br>
conscfg->pDeviceParams = (void *)115200;<br>
else if (strncmp (option, "57600", sizeof ("57600") - 1) == 0)<br>
--<br>
2.3.0<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div>