hostapd: backport BSSID black/whitelists
[openwrt.git] / package / network / services / hostapd / patches / 700-Add-os_snprintf_error-helper.patch
1 Add os_snprintf_error() helper
2
3 This can be used to check os_snprintf() return value more consistently.
4
5 Signed-off-by: Jouni Malinen <j@w1.fi>
6 ---
7  src/utils/os.h | 6 ++++++
8  1 file changed, 6 insertions(+)
9
10 diff --git a/src/utils/os.h b/src/utils/os.h
11 index b9247d8..77250d6 100644
12 --- a/src/utils/os.h
13 +++ b/src/utils/os.h
14 @@ -549,6 +549,12 @@ char * os_strdup(const char *s);
15  #endif /* OS_NO_C_LIB_DEFINES */
16  
17  
18 +static inline int os_snprintf_error(size_t size, int res)
19 +{
20 +       return res < 0 || (unsigned int) res >= size;
21 +}
22 +
23 +
24  static inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size)
25  {
26         if (size && nmemb > (~(size_t) 0) / size)
27 -- 
28 2.1.3
29