[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/22] lm32: avoid buffer overrun
From: |
Jim Meyering |
Subject: |
[Qemu-devel] [PATCH 05/22] lm32: avoid buffer overrun |
Date: |
Wed, 9 May 2012 11:23:49 +0200 |
From: Jim Meyering <address@hidden>
Actually do what the comment says, using pstrcpy to NUL-terminate:
strncpy does not always do that.
Signed-off-by: Jim Meyering <address@hidden>
---
hw/lm32_hwsetup.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
}
--
1.7.10.1.487.ga3935e6
- Re: [Qemu-devel] [PATCH 08/22] linux-user: remove two unchecked uses of strdup, (continued)
[Qemu-devel] [PATCH 03/22] vmdk: relative_path: avoid buffer overrun, Jim Meyering, 2012/05/09
[Qemu-devel] [PATCH 13/22] virtio-9p: avoid unwarranted use of strncpy, Jim Meyering, 2012/05/09
[Qemu-devel] [PATCH 05/22] lm32: avoid buffer overrun,
Jim Meyering <=
[Qemu-devel] [PATCH 19/22] qcow2: mark this file's sole strncpy use as justified, Jim Meyering, 2012/05/09
[Qemu-devel] [PATCH 21/22] scsi: mark an strncpy use as valid, Jim Meyering, 2012/05/09
Re: [Qemu-devel] strncpy: best avoided (resend), Kevin Wolf, 2012/05/10