diff options
author | pfg <pfg@FreeBSD.org> | 2016-05-13 02:58:11 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2016-05-13 02:58:11 +0000 |
commit | bfe13aa913c5751ecfab4b6eccf288f5386f2ed7 (patch) | |
tree | 757c3594df766e4e5606e0a126b2b37d6779ca18 | |
parent | f11b38fe039eb9b42196fe8d5e3bf27b4fcd4304 (diff) | |
download | FreeBSD-src-bfe13aa913c5751ecfab4b6eccf288f5386f2ed7.zip FreeBSD-src-bfe13aa913c5751ecfab4b6eccf288f5386f2ed7.tar.gz |
i2c(8): uninitialized variable (UNINIT).
If i2c_opt.width is somehow zero, the bufsize will be left uninitialized
and make cause trouble later on.
CID: 1331549
-rw-r--r-- | usr.sbin/i2c/i2c.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c index 3021b86..744fefc 100644 --- a/usr.sbin/i2c/i2c.c +++ b/usr.sbin/i2c/i2c.c @@ -294,7 +294,8 @@ i2c_write(char *dev, struct options i2c_opt, char *i2c_buf) err_msg = "error: offset malloc"; goto err1; } - } + } else + bufsize = 0; switch(i2c_opt.mode) { case I2C_MODE_STOP_START: |