wpa_supplicant/wpa_supplicant-alloc_size.patch
Ismail Dönmez bd16f667df Accepting request 299026 from home:elvigia:branches:hardware
- 0001-P2P-Validate-SSID-element-length-before-copying-it-C.patch 
  Fix CVE-2015-1863, memcpy overflow.
- wpa_supplicant-alloc_size.patch: annotate two wrappers
  with attribute alloc_size, which may help warning us of
  bugs such as the above.

OBS-URL: https://build.opensuse.org/request/show/299026
OBS-URL: https://build.opensuse.org/package/show/hardware/wpa_supplicant?expand=0&rev=52
2015-04-24 10:21:08 +00:00

21 lines
667 B
Diff

--- wpa_supplicant-2.4.orig/src/utils/os.h
+++ wpa_supplicant-2.4/src/utils/os.h
@@ -253,7 +253,7 @@ int os_file_exists(const char *fname);
*
* Caller is responsible for freeing the returned buffer with os_free().
*/
-void * os_zalloc(size_t size);
+void * os_zalloc(size_t size) __attribute((malloc, alloc_size(1)));
/**
* os_calloc - Allocate and zero memory for an array
@@ -267,6 +267,8 @@ void * os_zalloc(size_t size);
*
* Caller is responsible for freeing the returned buffer with os_free().
*/
+
+__attribute((malloc, alloc_size(1,2)))
static inline void * os_calloc(size_t nmemb, size_t size)
{
if (size && nmemb > (~(size_t) 0) / size)