OSDN Git Service
(root)
/
qmiga
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a79b5f8
)
lm32: avoid buffer overrun
author
Jim Meyering
<meyering@redhat.com>
Thu, 4 Oct 2012 11:09:50 +0000
(13:09 +0200)
committer
Anthony Liguori
<aliguori@us.ibm.com>
Fri, 5 Oct 2012 12:58:37 +0000
(07:58 -0500)
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>
hw/lm32_hwsetup.h
patch
|
blob
|
history
diff --git
a/hw/lm32_hwsetup.h
b/hw/lm32_hwsetup.h
index
8fc285e
..
70dc61f
100644
(file)
--- 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;
}