bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/6] Bug: shellexp: Fix off-by-one assignment in read_token_w


From: Michael Witten
Subject: Re: [PATCH 2/6] Bug: shellexp: Fix off-by-one assignment in read_token_word()
Date: Wed, 02 Mar 2011 06:25:28 -0800 (PST)

On looking over this patch, I found a number of `bugs' in my description,
but they don't change the conclusions. I should have proofread more carefully.

On Sat, 26 Feb 2011 09:48:06 -0700, Michael Witten wrote:

> /****** simulate peek_char and parse_matched_pair() ******/
> shell_getc (1);
> shell_getc (1);
> /*********************************************************/

That's actually missing one `shell_getc (1);' statement; it should be:

  /* Simulate peek_char */
  shell_getc (1);
  
  /* Simulate parse_matched_pair() */
  shell_getc (1);
  shell_getc (1);

> if (character == CTLESC || character == CTLNUL)
>   {
>     token[495] = CTLESC;
>     token_index=496;      /* assignment below: token[497] = CTLNUL; */
>   }

That comment should read `496' rather than `497':

  /* assignment below: token[496] = CTLNUL; */

Fortunately, the non-code description that followed got it right.

Also, it would have been helpful if these lines had been included, as
in the previous patch:

  #define TOKEN_DEFAULT_INITIAL_SIZE 496
  #define TOKEN_DEFAULT_GROW_SIZE 512

Sorry for the confusion.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]