Patch from vodz to fix a potential segfault
authorEric Andersen <andersen@codepoet.org>
Wed, 20 Mar 2002 14:31:15 +0000 (14:31 -0000)
committerEric Andersen <andersen@codepoet.org>
Wed, 20 Mar 2002 14:31:15 +0000 (14:31 -0000)
shell/cmdedit.c

index d4d6264d0fb018ce27f4676b5b5713590c4ce044..3810c230a5bcf555b8cae2845f696fa9486d0ecd 100644 (file)
@@ -799,8 +799,8 @@ static int match_compare(const void *a, const void *b)
 #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)
 {