mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-02-19 10:33:05 -05:00
Add wpabuf_clear_free() to allow clearing of freed memory
This can be useful when a wpabuf is used to store private data that should not be left in heap after use. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
59be78ef93
commit
77c45e2b35
@ -205,6 +205,15 @@ void wpabuf_free(struct wpabuf *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wpabuf_clear_free(struct wpabuf *buf)
|
||||||
|
{
|
||||||
|
if (buf) {
|
||||||
|
os_memset(wpabuf_mhead(buf), 0, wpabuf_len(buf));
|
||||||
|
wpabuf_free(buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void * wpabuf_put(struct wpabuf *buf, size_t len)
|
void * wpabuf_put(struct wpabuf *buf, size_t len)
|
||||||
{
|
{
|
||||||
void *tmp = wpabuf_mhead_u8(buf) + wpabuf_len(buf);
|
void *tmp = wpabuf_mhead_u8(buf) + wpabuf_len(buf);
|
||||||
|
@ -32,6 +32,7 @@ struct wpabuf * wpabuf_alloc_ext_data(u8 *data, size_t len);
|
|||||||
struct wpabuf * wpabuf_alloc_copy(const void *data, size_t len);
|
struct wpabuf * wpabuf_alloc_copy(const void *data, size_t len);
|
||||||
struct wpabuf * wpabuf_dup(const struct wpabuf *src);
|
struct wpabuf * wpabuf_dup(const struct wpabuf *src);
|
||||||
void wpabuf_free(struct wpabuf *buf);
|
void wpabuf_free(struct wpabuf *buf);
|
||||||
|
void wpabuf_clear_free(struct wpabuf *buf);
|
||||||
void * wpabuf_put(struct wpabuf *buf, size_t len);
|
void * wpabuf_put(struct wpabuf *buf, size_t len);
|
||||||
struct wpabuf * wpabuf_concat(struct wpabuf *a, struct wpabuf *b);
|
struct wpabuf * wpabuf_concat(struct wpabuf *a, struct wpabuf *b);
|
||||||
struct wpabuf * wpabuf_zeropad(struct wpabuf *buf, size_t len);
|
struct wpabuf * wpabuf_zeropad(struct wpabuf *buf, size_t len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user