reaver: fix gcc warnings

+ Fix out of bounds access to elements[] in libwps
+ Fix memset to zap ctx in md5-internal.c
This commit is contained in:
Jürgen Buchmüller 2017-01-09 01:01:17 +01:00
parent 0ba5258d65
commit 63505f358c
3 changed files with 28 additions and 3 deletions

View File

@ -0,0 +1,13 @@
Fix the calculation of the number of iterations.
--- src/libwps/libwps.c 2012-01-18 10:02:39.000000000 +0100
+++ src/libwps/libwps.c 2017-01-09 00:55:01.593948178 +0100
@@ -83,7 +83,7 @@
if(wps_ie_data)
{
- for(i=0; i<sizeof(elements); i++)
+ for(i=0; i<sizeof(elements)/sizeof(elements[0]); i++)
{
/* Search for each WPS element inside the WPS IE data blob */
el = get_wps_data_element(wps_ie_data, wps_data_len, elements[i], &el_len);

View File

@ -0,0 +1,13 @@
Fix size of memset which is what ctx points to.
--- src/crypto/md5-internal.c 2012-01-18 10:02:40.000000000 +0100
+++ src/crypto/md5-internal.c 2017-01-09 00:57:00.889939319 +0100
@@ -188,7 +188,7 @@
MD5Transform(ctx->buf, (u32 *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);
os_memcpy(digest, ctx->buf, 16);
- os_memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
+ os_memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
}
/* The four core functions - F1 is optimized somewhat */

View File

@ -1,7 +1,7 @@
# Template file for 'reaver'
pkgname=reaver
version=1.4
revision=1
revision=2
build_style=gnu-configure
build_wrksrc="src"
conf_files="/etc/reaver/reaver.db"
@ -15,8 +15,7 @@ checksum="add3050a4a05fe0ab6bfb291ee2de8e9b8a85f1e64ced93ee27a75744954b22d"
post_extract() {
case "$XBPS_TARGET_MACHINE" in
*-musl)
find -type f -exec sed -i "{}" -e"s;u_char;unsigned char;g" \;
*-musl) find -type f -exec sed -i "{}" -e"s;u_char;unsigned char;g" \;
;;
esac
}