[BusyBox] ash, ">" and tab autocompletion -> segfault

Vladimir N. Oleynik dzo at simtreas.ru
Mon Feb 18 03:22:03 UTC 2002


Giulio!

> busybox latest cvs, problem exists both with uclibc 0.9.9 and glibc-2.1.2
> (didn't try anything else).
> 
> All is ok if there's a "space" between ">" and path
> $ > ./a<TAB>
> ./applets/      ./archival/
> 
> if no "space" between ">" and path I get a segfault
> $ >./a<TAB>Segmentation fault (core dumped)

Thanks for bug report.
Heh, probably, it is time to me on pension. I have got on such standard mistake.
:)
Patch in attach.


--w
vodz
-------------- next part --------------
diff -rbu busybox.orig/shell/cmdedit.c busybox/shell/cmdedit.c
--- busybox.orig/shell/cmdedit.c	Mon Feb 18 13:09:13 2002
+++ busybox/shell/cmdedit.c	Mon Feb 18 13:11:30 2002
@@ -799,8 +799,8 @@
 #define QUOT    (UCHAR_MAX+1)
 
 #define collapse_pos(is, in) { \
-	memcpy(int_buf+is, int_buf+in, (BUFSIZ+1-is-in)*sizeof(int)); \
-	memcpy(pos_buf+is, pos_buf+in, (BUFSIZ+1-is-in)*sizeof(int)); }
+	memcpy(int_buf+(is), int_buf+(in), (BUFSIZ+1-(is)-(in))*sizeof(int)); \
+	memcpy(pos_buf+(is), pos_buf+(in), (BUFSIZ+1-(is)-(in))*sizeof(int)); }
 
 static int find_match(char *matchBuf, int *len_with_quotes)
 {


More information about the busybox mailing list