qcacmn: add argument '_len' sanity check before use

When argument '_len' is equal to 0 or less than 0, 'ascii'
array element will be used uninitialized. To fix this case,
add arguemnt sanity check before use.

Change-Id: I2e2a4c199fac72466f831bb4261a6a03ac116e11
CRs-Fixed: 2643354
This commit is contained in:
Rongjing Liao
2020-03-17 16:30:46 +08:00
committed by nshrivas
parent cff463564e
commit 2905808346

View File

@@ -75,6 +75,11 @@ static inline void target_if_spectral_hexdump(unsigned char *_buf, int _len)
qdf_mem_zero(hexdump_line, sizeof(hexdump_line));
if (_len <= 0) {
spectral_err("buffer len is %d, too short", _len);
return;
}
for (i = 0; i < _len; i++) {
mod = i % SPECTRAL_HEXDUMP_NUM_OCTETS_PER_LINE;