Josip Rodin writes:
 > On Tue, Oct 17, 2006 at 02:34:27PM -0700, Debian Bug Tracking System wrote:
 > > Processing commands for [EMAIL PROTECTED]:
 > > 
 > > > tags 392077 + patch
 > > Bug#392077: joe: execmd with empty command results in SEGV
 > > There were no tags set.
 > > Bug#392304: joe: yet another segfault: alt/x enter segfault(loss of data)
 > > Tags added: patch
 > 
 > On Tue, Oct 17, 2006 at 16:25:52 -0500, Kevin Glynn wrote:
 > > The attached patch to joe 3.5-1 just treats a blank command string
 > > (i.e. empty or all whitespace) as an unknown command.
 > 
 > Kevin, please Cc: the bug address when adding stuff, otherwise your mail is
 > relegated to a footnote in the bug log.
 > 

Sorry, first time I tried to add a patch.

 > I wonder, however, why this isn't handled by those bits:
 > 
 >      /* Do we have a command? */
 > [...]
 >                         if (!cmd) {
 >                                 *sta = -1;
 >                                 return NULL;
 > 

I believe we skip over this last statement because we are already at
the end of the buffer. The for loop finishes immediately and y still
equals x:

        /* Do we have a command? */
        else {
                for (y = x; buf[y] && buf[y]!='#' && buf[y] != '!' &&
                            buf[y] != '~' && buf[y] !='-' && buf[y] != ',' &&
                            buf[y] != ' ' && buf[y] != '\t' &&
                            buf[y] != '\n' && buf[x] != '\r'; ++y) ;

                if (y != x) {

[...]
                         if (!cmd) {
                                 *sta = -1;
                                 return NULL;
 


regards
Kevin



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to