Browse Source

fix segfault do to sizeof(NULL) usage

Mike Frysinger 19 years ago
parent
commit
cb1941ccfc
1 changed files with 4 additions and 2 deletions
  1. 4 2
      test/unistd/clone_cruft.h

+ 4 - 2
test/unistd/clone_cruft.h

@@ -2,10 +2,12 @@
 
 #undef do_clone
 
+#define crappy_sizeof(s) (s == NULL ? 0 : sizeof(s))
+
 #if defined __ia64__
 
 # define do_clone(fn, stack, flags, arg) \
-	__clone2(fn, stack, sizeof(stack), flags, arg, NULL, NULL, NULL)
+	__clone2(fn, stack, crappy_sizeof(stack), flags, arg, NULL, NULL, NULL)
 
 #elif defined __hppa__
 
@@ -15,6 +17,6 @@
 #else
 
 # define do_clone(fn, stack, flags, arg) \
-	clone(fn, stack+sizeof(stack), flags, arg)
+	clone(fn, stack+crappy_sizeof(stack), flags, arg)
 
 #endif