Signed-off-by: Guenter Roeck <guenter.roeck@xxxxxxxxxxxx> --- tools/i2cset.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/tools/i2cset.c b/tools/i2cset.c index e47c9d4..e835465 100644 --- a/tools/i2cset.c +++ b/tools/i2cset.c @@ -223,7 +223,11 @@ int main(int argc, char *argv[]) fprintf(stderr, "Error: PEC not supported for I2C block writes!\n"); help(); } - for (len = 0; len < (int)sizeof(block) && len + flags + 5 < argc; len++) { + if (argc > (int)sizeof(block) + flags + 5) { + fprintf(stderr, "Error: Too many arguments!\n"); + help(); + } + for (len = 0; len + flags + 5 < argc; len++) { value = strtol(argv[flags + len + 4], &end, 0); if (*end || value < 0 || value > 0xff) { fprintf(stderr, "Error: Block data value invalid!\n"); -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html