mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 22:51:35 +00:00
staging: rtl8712: fix boundary condition for n
Now that snprintf is replaced by scnprintf n >= MAX_WPA_IE_LEN doesn't make sense as the maximum value n can take is MAX_WPA_IE_LEN. Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20191002170518.GA1688@SARKAR Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f8fcbb6ba8
commit
b664312285
@ -144,7 +144,7 @@ static noinline_for_stack char *translate_scan_wpa(struct iw_request_info *info,
|
||||
for (i = 0; i < wpa_len; i++) {
|
||||
n += scnprintf(buf + n, MAX_WPA_IE_LEN - n,
|
||||
"%02x", wpa_ie[i]);
|
||||
if (n >= MAX_WPA_IE_LEN)
|
||||
if (n == MAX_WPA_IE_LEN-1)
|
||||
break;
|
||||
}
|
||||
memset(iwe, 0, sizeof(*iwe));
|
||||
@ -164,7 +164,7 @@ static noinline_for_stack char *translate_scan_wpa(struct iw_request_info *info,
|
||||
for (i = 0; i < rsn_len; i++) {
|
||||
n += scnprintf(buf + n, MAX_WPA_IE_LEN - n,
|
||||
"%02x", rsn_ie[i]);
|
||||
if (n >= MAX_WPA_IE_LEN)
|
||||
if (n == MAX_WPA_IE_LEN-1)
|
||||
break;
|
||||
}
|
||||
memset(iwe, 0, sizeof(*iwe));
|
||||
|
Loading…
Reference in New Issue
Block a user