aboutsummaryrefslogtreecommitdiff
path: root/hw/ide
diff options
context:
space:
mode:
authorFloris Bos <bos@je-eigen-domein.nl>2012-03-12 21:05:10 +0100
committerKevin Wolf <kwolf@redhat.com>2012-04-05 14:54:39 +0200
commitaa2c91bdfebbfa314e9522573a9656626e21ac67 (patch)
treea2a3b4d00a58a145f0be146b3a03de1f0fcf4101 /hw/ide
parent27e0c9a1bbd166a67c16291016fba298a8e47140 (diff)
ide: Change serial number strncpy() to pstrcpy()
strncpy may not null-terminate the destination string. Cc: kwolf@redhat.com Signed-off-by: Floris Bos <dev@noc-ps.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide')
-rw-r--r--hw/ide/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index e38cace45b..5647694585 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1879,7 +1879,7 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind,
}
}
if (serial) {
- strncpy(s->drive_serial_str, serial, sizeof(s->drive_serial_str));
+ pstrcpy(s->drive_serial_str, sizeof(s->drive_serial_str), serial);
} else {
snprintf(s->drive_serial_str, sizeof(s->drive_serial_str),
"QM%05d", s->drive_serial);