From: Jim Meyering Date: Thu, 4 Oct 2012 11:09:50 +0000 (+0200) Subject: lm32: avoid buffer overrun X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1044dc1118d9a90e2aa324047bea9c91c889e28f;p=qemu.git lm32: avoid buffer overrun Actually do what the comment says, using pstrcpy NUL-terminate: strncpy does not always do that. Signed-off-by: Jim Meyering Signed-off-by: Anthony Liguori --- diff --git a/hw/lm32_hwsetup.h b/hw/lm32_hwsetup.h index 8fc285efc2..70dc61f9e7 100644 --- a/hw/lm32_hwsetup.h +++ b/hw/lm32_hwsetup.h @@ -96,7 +96,7 @@ static inline void hwsetup_add_tag(HWSetup *hw, enum hwsetup_tag t) static inline void hwsetup_add_str(HWSetup *hw, const char *str) { - strncpy(hw->ptr, str, 31); /* make sure last byte is zero */ + pstrcpy(hw->ptr, 32, str); hw->ptr += 32; }