WPS: Add a workaround for parsing M1 from OS X 10.6

It looks like Mac OS X adds unexpected 0x00 padding to the end of M1.
Skip that padding to avoid interop issues.
This commit is contained in:
Jouni Malinen 2010-07-05 13:04:54 -07:00
parent 2d8bf73298
commit 612e9160e2

View file

@ -17,6 +17,8 @@
#include "common.h"
#include "wps_i.h"
#define WPS_WORKAROUNDS
static int wps_set_attr(struct wps_parse_attr *attr, u16 type,
const u8 *pos, u16 len)
@ -435,6 +437,25 @@ int wps_parse_msg(const struct wpabuf *msg, struct wps_parse_attr *attr)
return -1;
}
#ifdef WPS_WORKAROUNDS
if (type == 0 && len == 0) {
/*
* Mac OS X 10.6 seems to be adding 0x00 padding to the
* end of M1. Skip those to avoid interop issues.
*/
int i;
for (i = 0; i < end - pos; i++) {
if (pos[i])
break;
}
if (i == end - pos) {
wpa_printf(MSG_DEBUG, "WPS: Workaround - skip "
"unexpected message padding");
break;
}
}
#endif /* WPS_WORKAROUNDS */
if (wps_set_attr(attr, type, pos, len) < 0)
return -1;