]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: (sgi): use strncpy over strcpy
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 24 Dec 2023 12:45:38 +0000 (13:45 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Sun, 31 Dec 2023 12:06:02 +0000 (13:06 +0100)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
libfdisk/src/sgi.c

index 6740535046b808df87f4cd8ea27974323905e86b..4a2c9bbdc31e11edb1c26c9988e280a714f11808 100644 (file)
@@ -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);