From 2ef46ce4bae4073beda15cc8d9df7cc2eda88366 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 9 Mar 2017 08:06:53 -0600 Subject: [PATCH] NSH library: In nsh_argexand(), if CONFIG_NSH_ARGCAT is defined but CONFIG_NSH_CMDPARMS defined and/or CONFIG_DISABLE_ENVIRON not defined, then there is a situation that causes an infinite loop in the parser. Noted by Freddie Chopin. --- nshlib/nsh_parse.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nshlib/nsh_parse.c b/nshlib/nsh_parse.c index 71fc3795c..231dc2526 100644 --- a/nshlib/nsh_parse.c +++ b/nshlib/nsh_parse.c @@ -1,7 +1,7 @@ /**************************************************************************** * apps/nshlib/nsh_parse.c * - * Copyright (C) 2007-2013, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2013, 2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -1180,7 +1180,11 @@ static FAR char *nsh_argexpand(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline, else #endif { - /* Just to catch any dangling else clauses */ + /* Not a special character... skip to the next character in the + * cmdline. + */ + + working++; } } }