[BusyBox 0005824]: Since version 23530 with lineedit.c, "fdisk" & "ed" can't work any more

bugs at busybox.net bugs at busybox.net
Wed Oct 29 13:51:55 UTC 2008


The following issue has been SUBMITTED. 
====================================================================== 
http://busybox.net/bugs/view.php?id=5824 
====================================================================== 
Reported By:                rockeychu
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   5824
Category:                   Other
Reproducibility:            always
Severity:                   crash
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             10-29-2008 06:51 PDT
Last Modified:              10-29-2008 06:51 PDT
====================================================================== 
Summary:                    Since version 23530 with lineedit.c, "fdisk" & "ed"
can't work any more
Description: 
The reason is: 
The function read_line_input() declared as:  int FAST_FUNC
read_line_input(const char *prompt, char *command, int maxsize,
line_input_t *st)

But, when "fdisk" or "ed" calls read_line_input() with last param "st" set
as NULL, variable "state" will set as "(line_input_t*)&const_int_0" witch
just as "const int const_int_0 = 0", so, line 1418 will cause Segmentation
fault.

Patch as following:

Index: libbb/lineedit.c
===================================================================
--- libbb/lineedit.c    (revision 23852)
+++ libbb/lineedit.c    (working copy)
@@ -1415,7 +1415,8 @@
        if ((state->flags & SAVE_HISTORY) && state->hist_file)
                load_history(state->hist_file);
 #endif
-       state->cur_history = state->cnt_history;
+       if (state->flags)
+               state->cur_history = state->cnt_history;

        /* prepare before init handlers */
        cmdedit_y = 0;  /* quasireal y, not true if line > xt*yt */

====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
10-29-08 06:51  rockeychu      New Issue                                    
10-29-08 06:51  rockeychu      Status                   new => assigned     
10-29-08 06:51  rockeychu      Assigned To               => BusyBox         
======================================================================




More information about the busybox-cvs mailing list