2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 18:08:23 +00:00

In v{warning,fatal}x?() make a new copy of ap for the debug functions.

It is not legal to use ap twice without reinitializing it.
Noticed by Daniel Richard G.
This commit is contained in:
Todd C. Miller 2013-11-11 16:00:07 -07:00
parent 31e83c3e7a
commit 237ae0b773

View File

@ -89,25 +89,33 @@
} while (0) } while (0)
# endif /* __GNUC__ == 2 */ # endif /* __GNUC__ == 2 */
# define vfatal(fmt, ap) do { \ # define vfatal(fmt, ap) do { \
va_list ap2; \
va_copy(ap2, (ap)); \
sudo_debug_vprintf2(__func__, __FILE__, __LINE__, \ sudo_debug_vprintf2(__func__, __FILE__, __LINE__, \
SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys, \ SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys, \
(fmt), (ap)); \ (fmt), ap2); \
vfatal_nodebug((fmt), (ap)); \ vfatal_nodebug((fmt), (ap)); \
} while (0) } while (0)
# define vfatalx(fmt, ap) do { \ # define vfatalx(fmt, ap) do { \
va_list ap2; \
va_copy(ap2, (ap)); \
sudo_debug_vprintf2(__func__, __FILE__, __LINE__, \ sudo_debug_vprintf2(__func__, __FILE__, __LINE__, \
SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|sudo_debug_subsys, (fmt), (ap)); \ SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|sudo_debug_subsys, (fmt), ap2); \
vfatalx_nodebug((fmt), (ap)); \ vfatalx_nodebug((fmt), (ap)); \
} while (0) } while (0)
# define vwarning(fmt, ap) do { \ # define vwarning(fmt, ap) do { \
va_list ap2; \
va_copy(ap2, (ap)); \
sudo_debug_vprintf2(__func__, __FILE__, __LINE__, \ sudo_debug_vprintf2(__func__, __FILE__, __LINE__, \
SUDO_DEBUG_WARN|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys, \ SUDO_DEBUG_WARN|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO|sudo_debug_subsys, \
(fmt), (ap)); \ (fmt), ap2); \
vwarning_nodebug((fmt), (ap)); \ vwarning_nodebug((fmt), (ap)); \
} while (0) } while (0)
# define vwarningx(fmt, ap) do { \ # define vwarningx(fmt, ap) do { \
va_list ap2; \
va_copy(ap2, (ap)); \
sudo_debug_vprintf2(__func__, __FILE__, __LINE__, \ sudo_debug_vprintf2(__func__, __FILE__, __LINE__, \
SUDO_DEBUG_WARN|SUDO_DEBUG_LINENO|sudo_debug_subsys, (fmt), (ap)); \ SUDO_DEBUG_WARN|SUDO_DEBUG_LINENO|sudo_debug_subsys, (fmt), ap2); \
vwarningx_nodebug((fmt), (ap)); \ vwarningx_nodebug((fmt), (ap)); \
} while (0) } while (0)
#endif /* SUDO_ERROR_WRAP */ #endif /* SUDO_ERROR_WRAP */