diff options
author | Jim Meyering <meyering@redhat.com> | 2012-10-04 13:09:50 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-10-05 07:58:37 -0500 |
commit | 1044dc1118d9a90e2aa324047bea9c91c889e28f (patch) | |
tree | 39bf965f0e9436ccb0f20d1459dcdf6574a0c114 | |
parent | a79b5f8b80890b402fdb0733b0a073695a7875b5 (diff) | |
download | qemu-1044dc1118d9a90e2aa324047bea9c91c889e28f.zip qemu-1044dc1118d9a90e2aa324047bea9c91c889e28f.tar.gz qemu-1044dc1118d9a90e2aa324047bea9c91c889e28f.tar.bz2 |
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 <meyering@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | hw/lm32_hwsetup.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/lm32_hwsetup.h b/hw/lm32_hwsetup.h index 8fc285e..70dc61f 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; } |