buf_size: fix handling of 1 element arrays
commitc74262a802386c0fdc3af2cbed193448da934b82
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 29 Nov 2018 10:13:31 +0000 (29 13:13 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Thu, 29 Nov 2018 14:27:00 +0000 (29 17:27 +0300)
tree0d37b0362039af3be2aab11b051aafd3c4ead6fa
parent0f27be677af91b4b9147399642814bdcd80e898b
buf_size: fix handling of 1 element arrays

I originally wrote a hack to say that 1 element arrays were really an
unknown size because they're often used as the last member of a struct like
this:

struct my_struct {
...
unsigned int buf_size;
char buf[1];
};

(In olden days, compilers didn't allow zero size arrays??)

Anyway, this hack was bad because sometimes a one element array is what
people want and also these days we should return -1 for unknown size
arrays.  So I have removed this hack.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
check_snprintf_overflow.c
smatch_buf_size.c