]> git.ipfire.org Git - thirdparty/hostap.git/commit - wpa_supplicant/config.c
Increase buffer size and prevent write beyond buffer end
authorPontus Fuchs <pontus.fuchs@gmail.com>
Mon, 14 Oct 2013 17:49:26 +0000 (20:49 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 14 Oct 2013 17:49:26 +0000 (20:49 +0300)
commit5079392954c80573234952772dc39dbb5d3179ca
tree287c6f4e58e4c16994b8764af6c09fdfcbdb9e97
parentded22b5390cba3dcb28ef590acba203fd0117d70
Increase buffer size and prevent write beyond buffer end

wpa_config_write_key_mgmt has a buffer size of 50. This is not enough
to fit the longest case. I used a network with "WPA-PSK WPA-EAP
WPA-NONE" and CONFIG_IEEE80211R=y + CONFIG_IEEE80211W=y to produce
a string longer than 50 chars. Increase the buffer size to 100 to
prevent truncated output.

Truncated output is not the only problem. If the buffer end is
reached when adding certain key mgmt types the function does not
return immediately. This leaves pos > end. When a second os_sprintf
is called the calculation of end - pos yields a large positive
number for buffer size. End result is a write beyond the buffer end.
Fix this by bailing out if buffer end is reached.

Signed-hostap: Pontus Fuchs <pontus.fuchs@gmail.com>
wpa_supplicant/config.c