diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2015-07-07 22:20:33 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2015-07-07 22:20:33 +0300 |
commit | 4cd67264c36dca10ab64608efa94f02556abdc03 (patch) | |
tree | a4221d2ea3c0d7f2d2b3fbc2c4c366b35df7084a /client | |
parent | 7ae2fb58d0c43e03df2d810c7ce47be1b4020084 (diff) | |
download | bluez-4cd67264c36dca10ab64608efa94f02556abdc03.tar.gz |
client: Fix potential array overflow
Diffstat (limited to 'client')
-rw-r--r-- | client/gatt.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/client/gatt.c b/client/gatt.c index 737eceafc..0a3adb8c4 100644 --- a/client/gatt.c +++ b/client/gatt.c @@ -421,7 +421,7 @@ static void write_attribute(GDBusProxy *proxy, char *arg) struct iovec iov; uint8_t value[512]; char *entry; - int i; + unsigned int i; for (i = 0; (entry = strsep(&arg, " \t")) != NULL; i++) { long int val; @@ -430,7 +430,7 @@ static void write_attribute(GDBusProxy *proxy, char *arg) if (*entry == '\0') continue; - if (i > 512) { + if (i >= G_N_ELEMENTS(value)) { rl_printf("Too much data\n"); return; } |