From 5d051cd6c69cb073f5cccbe2d8196929fde61fad Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sun, 24 Dec 2023 13:45:38 +0100 Subject: [PATCH] libfdisk: (sgi): use strncpy over strcpy MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Weißschuh --- libfdisk/src/sgi.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libfdisk/src/sgi.c b/libfdisk/src/sgi.c index 6740535046..4a2c9bbdc3 100644 --- a/libfdisk/src/sgi.c +++ b/libfdisk/src/sgi.c @@ -123,10 +123,12 @@ static struct sgi_info *sgi_new_info(void) info->b3 = cpu_to_be16(1); /* You may want to replace this string !!!!!!! */ - strcpy((char *) info->scsi_string, "IBM OEM 0662S12 3 30"); - strcpy((char *) info->serial, "0000"); + strncpy((char *) info->scsi_string, "IBM OEM 0662S12 3 30", + sizeof(info->scsi_string)); + strncpy((char *) info->serial, "0000", sizeof(info->serial)); info->check1816 = cpu_to_be16(18 * 256 + 16); - strcpy((char *) info->installer, "Sfx version 5.3, Oct 18, 1994"); + strncpy((char *) info->installer, "Sfx version 5.3, Oct 18, 1994", + sizeof(info->installer)); return info; } @@ -1009,7 +1011,8 @@ static int sgi_create_disklabel(struct fdisk_context *cxt) /* sizeof(sgilabel->boot_file) = 16 > 6 */ memset(sgilabel->boot_file, 0, 16); - strcpy((char *) sgilabel->boot_file, "/unix"); + strncpy((char *) sgilabel->boot_file, "/unix", + sizeof(sgilabel->boot_file)); sgilabel->devparam.skew = (0); sgilabel->devparam.gap1 = (0); -- 2.47.3