CLE: Forgot to NUL terminate the command line
This commit is contained in:
parent
9d49d3969f
commit
3fbce9ed5e
@ -813,8 +813,7 @@
|
|||||||
6.34 2014-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
6.34 2014-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
|
||||||
* apps/system/cle: Add a EMACS-like command line editor. This CLE,
|
* apps/system/cle: Add a EMACS-like command line editor. This CLE,
|
||||||
is really more like readline than the NuttX readline is! Not fully
|
is really more like readline than the NuttX readline is! (2014-02-02).
|
||||||
fully on initial checkout (2014-02-02).
|
|
||||||
* apps/nshlib: Use of the standard tiney readline (about .25KB) is now
|
* apps/nshlib: Use of the standard tiney readline (about .25KB) is now
|
||||||
an option and can be replaces with the EMACX-like CLE (about 2KB)
|
an option and can be replaces with the EMACX-like CLE (about 2KB)
|
||||||
(2014-02-02).
|
(2014-02-02).
|
||||||
|
@ -536,7 +536,8 @@ static void cle_clrtoeol(FAR struct cle_s *priv)
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Make space for new text of size 'increment' at the specified cursor
|
* Make space for new text of size 'increment' at the specified cursor
|
||||||
* position.
|
* position. This function will not allow text grow beyound (linelen - 1)
|
||||||
|
* in size.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -550,8 +551,9 @@ static bool cle_opentext(FAR struct cle_s *priv, uint16_t pos, uint16_t incremen
|
|||||||
* of 'increment'
|
* of 'increment'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->nchars + increment > priv->linelen)
|
if (priv->nchars + increment >= priv->linelen)
|
||||||
{
|
{
|
||||||
|
CLE_BEL(priv);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,7 +643,7 @@ static void cle_showtext(FAR struct cle_s *priv)
|
|||||||
|
|
||||||
/* Loop for each column */
|
/* Loop for each column */
|
||||||
|
|
||||||
for (column = 0; column < priv->nchars && column < priv->linelen; )
|
for (column = 0; column < priv->nchars; )
|
||||||
{
|
{
|
||||||
/* Perform TAB expansion */
|
/* Perform TAB expansion */
|
||||||
|
|
||||||
@ -937,5 +939,10 @@ int cle(FAR char *line, uint16_t linelen, FILE *instream, FILE *outstream)
|
|||||||
|
|
||||||
/* The editor loop */
|
/* The editor loop */
|
||||||
|
|
||||||
return cle_editloop(&priv);
|
ret = cle_editloop(&priv);
|
||||||
|
|
||||||
|
/* Make sure that the line is NUL terminated */
|
||||||
|
|
||||||
|
line[priv.nchars] = '\0';
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user