diff options
author | Andreas Schultz <andreas.schultz@travelping.com> | 2020-05-15 11:50:07 +0200 |
---|---|---|
committer | Ivan Shvedunov <ivan4th@gmail.com> | 2022-07-06 03:32:18 +0400 |
commit | 972dc17634e430cb93b97c67b50096acc3164231 (patch) | |
tree | 2a091bf4b3a16b7c750dda72f268052141ff6dbe /src/vlib/unix/main.c | |
parent | f8631ce7e8886136b4543a7926ffdf1bc760fb11 (diff) |
misc: pass NULL instead of 0 for pointer in variadic functions
0 is not NULL (at least not in all cases), passing 0 into a variadic
function in a place where the consumer reads it as pointer might
leave parts of the pointer uninitilized and hence filled with random
data.
It seems that this used to work with gcc, but clang seems to treat the
0 in those places as a 32bit integer.
Type: fix
Signed-off-by: Ivan Shvedunov <ivan4th@gmail.com>
Signed-off-by: Andreas Schultz <andreas.schultz@travelping.com>
Change-Id: I37d975eef5a1ad98fbfb65ebe47d73458aafea00
Diffstat (limited to 'src/vlib/unix/main.c')
-rw-r--r-- | src/vlib/unix/main.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c index fd8a7e863a1..6b1a32cfee6 100644 --- a/src/vlib/unix/main.c +++ b/src/vlib/unix/main.c @@ -327,17 +327,16 @@ startup_config_process (vlib_main_t * vm, { u8 *lv = 0; lv = format (lv, "%U: ***** Startup Config *****\n%v", - format_timeval, 0 /* current bat-time */ , - 0 /* current bat-format */ , - buf); + format_timeval, NULL /* current bat-format */, + 0 /* current bat-time */, buf); { int rv __attribute__ ((unused)) = write (um->log_fd, lv, vec_len (lv)); } vec_reset_length (lv); - lv = format (lv, "%U: ***** End Startup Config *****\n", - format_timeval, 0 /* current bat-time */ , - 0 /* current bat-format */ ); + lv = + format (lv, "%U: ***** End Startup Config *****\n", format_timeval, + NULL /* current bat-format */, 0 /* current bat-time */); { int rv __attribute__ ((unused)) = write (um->log_fd, lv, vec_len (lv)); @@ -477,9 +476,8 @@ unix_config (vlib_main_t * vm, unformat_input_t * input) { u8 *lv = 0; lv = format (0, "%U: ***** Start: PID %d *****\n", - format_timeval, 0 /* current bat-time */ , - 0 /* current bat-format */ , - getpid ()); + format_timeval, NULL /* current bat-format */, + 0 /* current bat-time */, getpid ()); { int rv __attribute__ ((unused)) = write (um->log_fd, lv, vec_len (lv)); |