From: Jouni Malinen Date: Tue, 10 Nov 2009 15:08:33 +0000 (+0200) Subject: driver_prism54: Use os_zalloc instead of malloc to clear memory X-Git-Tag: hostap_0_7_0~79 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=libeap.git;a=commitdiff_plain;h=feae037c25b93820e3c6d52bebd8c8d592beb18f driver_prism54: Use os_zalloc instead of malloc to clear memory This will make sure the full buffer is initialized even if some fields were not explicitly set. --- diff --git a/src/drivers/driver_prism54.c b/src/drivers/driver_prism54.c index f2c6916..c43aecc 100644 --- a/src/drivers/driver_prism54.c +++ b/src/drivers/driver_prism54.c @@ -168,7 +168,7 @@ static int prism54_set_sta_authorized(void *priv, const u8 *addr, pimdev_hdr *hdr; char *pos; - hdr = malloc(sizeof(*hdr) + ETH_ALEN); + hdr = os_zalloc(sizeof(*hdr) + ETH_ALEN); if (hdr == NULL) return -1; hdr->op = htonl(PIMOP_SET); @@ -212,7 +212,7 @@ static int prism54_set_key(const char *ifname, void *priv, wpa_alg alg, int ret = 0; blen = sizeof(struct obj_stakey) + sizeof(pimdev_hdr); - hdr = malloc(blen); + hdr = os_zalloc(blen); if (hdr == NULL) { printf("memory low\n"); return -1; @@ -276,7 +276,7 @@ static int prism54_get_seqnum(const char *ifname, void *priv, const u8 *addr, int ret = 0; blen = sizeof(*stasc) + sizeof(*hdr); - hdr = malloc(blen); + hdr = os_zalloc(blen); if (hdr == NULL) return -1; @@ -318,7 +318,7 @@ static int prism54_init_1x(void *priv) unsigned long *ul; int blen = sizeof(*hdr) + sizeof(*ul); - hdr = malloc(blen); + hdr = os_zalloc(blen); if (hdr == NULL) return -1; @@ -356,7 +356,7 @@ static int prism54_set_privacy_invoked(const char *ifname, void *priv, unsigned long *ul; int ret; int blen = sizeof(*hdr) + sizeof(*ul); - hdr = malloc(blen); + hdr = os_zalloc(blen); if (hdr == NULL) return -1; ul = (unsigned long *) &hdr[1]; @@ -469,7 +469,7 @@ static int prism54_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr, struct obj_mlmeex *mlme; int ret; int blen = sizeof(*hdr) + sizeof(*mlme); - hdr = malloc(blen); + hdr = os_zalloc(blen); if (hdr == NULL) return -1; mlme = (struct obj_mlmeex *) &hdr[1]; @@ -495,7 +495,7 @@ static int prism54_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr, struct obj_mlmeex *mlme; int ret; int blen = sizeof(*hdr) + sizeof(*mlme); - hdr = malloc(blen); + hdr = os_zalloc(blen); if (hdr == NULL) return -1; mlme = (struct obj_mlmeex *) &hdr[1]; @@ -521,7 +521,7 @@ static int prism54_get_inact_sec(void *priv, const u8 *addr) int blen = sizeof(*hdr) + sizeof(*sta); int ret; - hdr = malloc(blen); + hdr = os_zalloc(blen); if (hdr == NULL) return -1; hdr->op = htonl(PIMOP_GET);