From aa2c91bdfebbfa314e9522573a9656626e21ac67 Mon Sep 17 00:00:00 2001 From: Floris Bos Date: Mon, 12 Mar 2012 21:05:10 +0100 Subject: ide: Change serial number strncpy() to pstrcpy() strncpy may not null-terminate the destination string. Cc: kwolf@redhat.com Signed-off-by: Floris Bos Signed-off-by: Kevin Wolf --- hw/ide/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw/ide') diff --git a/hw/ide/core.c b/hw/ide/core.c index e38cace..5647694 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); -- cgit v1.1