From: Jouni Malinen Date: Mon, 5 Jul 2010 20:04:54 +0000 (-0700) Subject: WPS: Add a workaround for parsing M1 from OS X 10.6 X-Git-Tag: hostap-1-bp~1274 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=612e9160e229fc60e362e7cbecc11363ece640f0;p=thirdparty%2Fhostap.git 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. --- diff --git a/src/wps/wps_attr_parse.c b/src/wps/wps_attr_parse.c index b18572109..30b0e7921 100644 --- a/src/wps/wps_attr_parse.c +++ b/src/wps/wps_attr_parse.c @@ -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;