The bug happens, for example, in the following:
printf("%s%s\n", (efi_time_t_to_tm(buf), efi_time_t_to_tm(buf)));
where efi_time_t_to_tm() returns a pointer to buf, the address of the
buffer passed to in the first argument. Obviously, the second call
overwrites the result of the first call.
It's dull to prepare a buffer for each function call, so I avoid this
simply by calling printf() for each efi_time_to_tm() call:
printf("%s", efi_time_t_to_tm(buf));
printf("%s\n", efi_time_t_to_tm(buf));
When the second call overwrites the result of the first call, printf()
has already finished displaying it.
Also I change efi_time_t_to_tm() so that it uses local buffer. It's
safe if following the above use.
Signed-off-by: HATAYAMA Daisuke <d.hatayama(a)jp.fujitsu.com>
---
sadump.c | 76 +++++++++++++++++++++++++++++++-------------------------------
1 files changed, 38 insertions(+), 38 deletions(-)