mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 06:30:33 +01:00
glib-aux: hide API g_alloca0() and g_newa0()
For one, this API is only available since 2.72, thus we must not use it (unless we would add a compat implementation to nm-glib.h). But also, g_alloca0() evaluates the size argument multiple times, making it non-function like. That seems highly undesirable and error prone. Also, we should be very careful about alloca() and the potential for stack overflow. We use alloca() at times, but usually with macros that are named "*_a()" (to make the danger clearer) and compile time checks for the size. These glib functions make this slightly less safe. Just prevent us from using this API.
This commit is contained in:
parent
fbee64e979
commit
5cf4d3c744
1 changed files with 10 additions and 0 deletions
|
|
@ -717,4 +717,14 @@ _nm_deprecated("Don't use this API") void _nm_forbidden_glib_api_n(gconstpointer
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* g_alloca0() evaluates the "size" argument multiple times. That seems an error
|
||||
* prone API (as it's not function-like).
|
||||
*
|
||||
* We could fix it by using an expression statement. But it doesn't seem
|
||||
* worth it, so hide it to prevent its use. */
|
||||
#undef g_alloca0
|
||||
#undef g_newa0
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif /* __NM_GLIB_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue