[U-Boot] [PATCH 1/1] tools: sunxi: avoid possible null pointer dereference

Heinrich Schuchardt xypron.glpk at gmx.de
Wed May 3 21:11:19 UTC 2017


If endptr is NULL we should not dereference it.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 tools/sunxi-spl-image-builder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/sunxi-spl-image-builder.c b/tools/sunxi-spl-image-builder.c
index d538a38813..0072a64728 100644
--- a/tools/sunxi-spl-image-builder.c
+++ b/tools/sunxi-spl-image-builder.c
@@ -433,7 +433,7 @@ int main(int argc, char **argv)
 			break;
 		case 'c':
 			info.ecc_strength = strtol(optarg, &endptr, 0);
-			if (endptr || *endptr == '/')
+			if (endptr && *endptr == '/')
 				info.ecc_step_size = strtol(endptr + 1, NULL, 0);
 			break;
 		case 'p':
-- 
2.11.0



More information about the U-Boot mailing list