When I run
busybox ash on an arm device with busybox built with clang 6.
I got a segmentation fault
in the macro
#define INIT_S() do { \
(*(struct lineedit_statics**)&lineedit_ptr_to_statics) =
xzalloc(sizeof(S)); \
barrier(); \
cmdedit_termw = 80; \
IF_USERNAME_OR_HOMEDIR(home_pwd_buf = (char*)null_str;) \
IF_FEATURE_EDITING_VI(delptr = delbuf;) \
} while (0)

With the patch below, the segmentation disappears.

--- busybox-1.27.2/libbb/lineedit.c
+++ busybox-1.27.2/libbb/lineedit.c
@@ -197,8 +197,8 @@ extern struct lineedit_statics *const li
  (*(struct lineedit_statics**)&lineedit_ptr_to_statics) =
xzalloc(sizeof(S)); \
  barrier(); \
  cmdedit_termw = 80; \
- IF_USERNAME_OR_HOMEDIR(home_pwd_buf = (char*)null_str;) \
- IF_FEATURE_EDITING_VI(delptr = delbuf;) \
+ IF_USERNAME_OR_HOMEDIR(home_pwd_buf = (char*)null_str;); \
+ IF_FEATURE_EDITING_VI(delptr = delbuf;); \
 } while (0)

 static void deinit_S(void)
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to