kunit: Protect string comparisons against NULL
Changes
1 files changed · +1 −1
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| include/kunit/test.h | modified | +1 | −1 | View file |
include/kunit/test.h
View filediff --git a/include/kunit/test.h b/include/kunit/test.h
index b163b99..c2ce379 100644
--- a/include/kunit/test.h
+++ b/include/kunit/test.h
@@ -758,7 +758,7 @@ do { \
.right_text = #right, \
}; \
\
- if (likely(strcmp(__left, __right) op 0)) \
+ if (likely((__left) && (__right) && (strcmp(__left, __right) op 0))) \
break; \
\
\