HS 2.0: Fix hs20_get_icon() error path
If base64_encode() fails (e.g., due to memory allocation failure), the return value needs to be checked against NULL before using the (not really) returned length value. The error path here ended up reading uninitialized variable. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
8e590f02bd
commit
75b2a87952
1 changed files with 1 additions and 1 deletions
|
@ -320,7 +320,7 @@ int hs20_get_icon(struct wpa_supplicant *wpa_s, const u8 *bssid,
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
b64 = base64_encode(&icon->image[offset], size, &b64_size);
|
b64 = base64_encode(&icon->image[offset], size, &b64_size);
|
||||||
if (buf_len >= b64_size) {
|
if (b64 && buf_len >= b64_size) {
|
||||||
os_memcpy(reply, b64, b64_size);
|
os_memcpy(reply, b64, b64_size);
|
||||||
reply_size = b64_size;
|
reply_size = b64_size;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue