aboutsummaryrefslogtreecommitdiffstats
path: root/com32/gpllib
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2010-06-22 21:43:27 +0200
committerErwan Velu <erwanaliasr1@gmail.com>2010-06-22 21:43:27 +0200
commite7fa1978a0fa326d50bff091b454ecc06aec5330 (patch)
tree93b9335e71e8a68ac3b226c55c1d71148ba0d384 /com32/gpllib
parent3e3afd955d5708c65c33545c7f3094999a7f1395 (diff)
downloadsyslinux-e7fa1978a0fa326d50bff091b454ecc06aec5330.tar.gz
syslinux-e7fa1978a0fa326d50bff091b454ecc06aec5330.tar.xz
syslinux-e7fa1978a0fa326d50bff091b454ecc06aec5330.zip
Replacing strncpy by strlcpy
As reported by hpa, strlcpy is safer and could prevent some bugs. So I replaced all strncpy by strlcpy calls.
Diffstat (limited to 'com32/gpllib')
-rw-r--r--com32/gpllib/cpuid.c4
-rw-r--r--com32/gpllib/disk/bootloaders.c6
-rw-r--r--com32/gpllib/disk/labels.c466
-rw-r--r--com32/gpllib/disk/mbrs.c46
-rw-r--r--com32/gpllib/dmi/dmi.c154
-rw-r--r--com32/gpllib/memory.c2
-rw-r--r--com32/gpllib/vpd/vpd.c14
7 files changed, 346 insertions, 346 deletions
diff --git a/com32/gpllib/cpuid.c b/com32/gpllib/cpuid.c
index f33e8958..2d5b5ce9 100644
--- a/com32/gpllib/cpuid.c
+++ b/com32/gpllib/cpuid.c
@@ -423,9 +423,9 @@ void set_generic_info(struct cpuinfo_x86 *c, s_cpu * cpu)
cpu->vendor_id = c->x86_vendor;
cpu->model_id = c->x86_model;
cpu->stepping = c->x86_mask;
- strncpy(cpu->vendor, cpu_devs[c->x86_vendor]->c_vendor,
+ strlcpy(cpu->vendor, cpu_devs[c->x86_vendor]->c_vendor,
sizeof(cpu->vendor));
- strncpy(cpu->model, c->x86_model_id, sizeof(cpu->model));
+ strlcpy(cpu->model, c->x86_model_id, sizeof(cpu->model));
cpu->num_cores = c->x86_num_cores;
cpu->l1_data_cache_size = c->x86_l1_data_cache_size;
cpu->l1_instruction_cache_size = c->x86_l1_instruction_cache_size;
diff --git a/com32/gpllib/disk/bootloaders.c b/com32/gpllib/disk/bootloaders.c
index 188dd64b..e0340112 100644
--- a/com32/gpllib/disk/bootloaders.c
+++ b/com32/gpllib/disk/bootloaders.c
@@ -31,11 +31,11 @@ int get_bootloader_string(struct driveinfo *d, const struct part_entry *p,
return -1;
else {
if (!strncmp(boot_sector + 3, "SYSLINUX", 8))
- strncpy(buffer, "SYSLINUX", buffer_size - 1);
+ strlcpy(buffer, "SYSLINUX", buffer_size - 1);
else if (!strncmp(boot_sector + 3, "EXTLINUX", 8))
- strncpy(buffer, "EXTLINUX", buffer_size - 1);
+ strlcpy(buffer, "EXTLINUX", buffer_size - 1);
else if (!strncmp(boot_sector + 3, "MSWIN4.1", 8))
- strncpy(buffer, "MSWIN4.1", buffer_size - 1);
+ strlcpy(buffer, "MSWIN4.1", buffer_size - 1);
else
return -1;
/* Add more... */
diff --git a/com32/gpllib/disk/labels.c b/com32/gpllib/disk/labels.c
index 8017d48a..ad3d33b3 100644
--- a/com32/gpllib/disk/labels.c
+++ b/com32/gpllib/disk/labels.c
@@ -18,637 +18,637 @@ void get_label(int label, char **buffer_label)
switch (label) {
case 0x01:
- strncpy(buffer, "DOS 12-bit fat", buffer_size);
+ strlcpy(buffer, "DOS 12-bit fat", buffer_size);
break;
case 0x02:
- strncpy(buffer, "XENIX root", buffer_size);
+ strlcpy(buffer, "XENIX root", buffer_size);
break;
case 0x03:
- strncpy(buffer, "XENIX /usr", buffer_size);
+ strlcpy(buffer, "XENIX /usr", buffer_size);
break;
case 0x04:
- strncpy(buffer, "DOS 3.0+ 16-bit FAT (up to 32M)", buffer_size);
+ strlcpy(buffer, "DOS 3.0+ 16-bit FAT (up to 32M)", buffer_size);
break;
case 0x05:
- strncpy(buffer, "DOS 3.3+ Extended Partition", buffer_size);
+ strlcpy(buffer, "DOS 3.3+ Extended Partition", buffer_size);
break;
case 0x06:
- strncpy(buffer, "DOS 3.31+ 16-bit FAT (over 32M)", buffer_size);
+ strlcpy(buffer, "DOS 3.31+ 16-bit FAT (over 32M)", buffer_size);
break;
case 0x07:
- strncpy(buffer, "OS/2 IFS (e.g., HPFS)", buffer_size);
+ strlcpy(buffer, "OS/2 IFS (e.g., HPFS)", buffer_size);
break;
- //case 0x07: strncpy(buffer, "Advanced Unix", buffer_size); break;
- //case 0x07: strncpy(buffer, "Windows NT NTFS", buffer_size); break;
- //case 0x07: strncpy(buffer, "QNX2.x (pre-1988)", buffer_size); break;
+ //case 0x07: strlcpy(buffer, "Advanced Unix", buffer_size); break;
+ //case 0x07: strlcpy(buffer, "Windows NT NTFS", buffer_size); break;
+ //case 0x07: strlcpy(buffer, "QNX2.x (pre-1988)", buffer_size); break;
case 0x08:
- strncpy(buffer, "OS/2 (v1.0-1.3 only)", buffer_size);
+ strlcpy(buffer, "OS/2 (v1.0-1.3 only)", buffer_size);
break;
- //case 0x08: strncpy(buffer, "AIX boot partition", buffer_size); break;
- //case 0x08: strncpy(buffer, "SplitDrive", buffer_size); break;
- //case 0x08: strncpy(buffer, "DELL partition spanning multiple drives", buffer_size); break;
- //case 0x08: strncpy(buffer, "Commodore DOS", buffer_size); break;
- //case 0x08: strncpy(buffer, "QNX 1.x and 2.x ("qny")", buffer_size); break;
+ //case 0x08: strlcpy(buffer, "AIX boot partition", buffer_size); break;
+ //case 0x08: strlcpy(buffer, "SplitDrive", buffer_size); break;
+ //case 0x08: strlcpy(buffer, "DELL partition spanning multiple drives", buffer_size); break;
+ //case 0x08: strlcpy(buffer, "Commodore DOS", buffer_size); break;
+ //case 0x08: strlcpy(buffer, "QNX 1.x and 2.x ("qny")", buffer_size); break;
case 0x09:
- strncpy(buffer, "AIX data partition", buffer_size);
+ strlcpy(buffer, "AIX data partition", buffer_size);
break;
- //case 0x09: strncpy(buffer, "Coherent filesystem", buffer_size); break;
- //case 0x09: strncpy(buffer, "QNX 1.x and 2.x ("qnz")", buffer_size); break;
+ //case 0x09: strlcpy(buffer, "Coherent filesystem", buffer_size); break;
+ //case 0x09: strlcpy(buffer, "QNX 1.x and 2.x ("qnz")", buffer_size); break;
case 0x0a:
- strncpy(buffer, "OS/2 Boot Manager", buffer_size);
+ strlcpy(buffer, "OS/2 Boot Manager", buffer_size);
break;
- //case 0x0a: strncpy(buffer, "Coherent swap partition", buffer_size); break;
- //case 0x0a: strncpy(buffer, "OPUS", buffer_size); break;
+ //case 0x0a: strlcpy(buffer, "Coherent swap partition", buffer_size); break;
+ //case 0x0a: strlcpy(buffer, "OPUS", buffer_size); break;
case 0x0b:
- strncpy(buffer, "WIN95 OSR2 32-bit FAT", buffer_size);
+ strlcpy(buffer, "WIN95 OSR2 32-bit FAT", buffer_size);
break;
case 0x0c:
- strncpy(buffer, "WIN95 OSR2 32-bit FAT, LBA-mapped", buffer_size);
+ strlcpy(buffer, "WIN95 OSR2 32-bit FAT, LBA-mapped", buffer_size);
break;
case 0x0e:
- strncpy(buffer, "WIN95: DOS 16-bit FAT, LBA-mapped", buffer_size);
+ strlcpy(buffer, "WIN95: DOS 16-bit FAT, LBA-mapped", buffer_size);
break;
case 0x0f:
- strncpy(buffer, "WIN95: Extended partition, LBA-mapped", buffer_size);
+ strlcpy(buffer, "WIN95: Extended partition, LBA-mapped", buffer_size);
break;
case 0x10:
- strncpy(buffer, "OPUS (?)", buffer_size);
+ strlcpy(buffer, "OPUS (?)", buffer_size);
break;
case 0x11:
- strncpy(buffer, "Hidden DOS 12-bit FAT", buffer_size);
+ strlcpy(buffer, "Hidden DOS 12-bit FAT", buffer_size);
break;
case 0x12:
- strncpy(buffer, "Compaq config partition", buffer_size);
+ strlcpy(buffer, "Compaq config partition", buffer_size);
break;
case 0x14:
- strncpy(buffer, "Hidden DOS 16-bit FAT <32M", buffer_size);
+ strlcpy(buffer, "Hidden DOS 16-bit FAT <32M", buffer_size);
break;
case 0x16:
- strncpy(buffer, "Hidden DOS 16-bit FAT >=32M", buffer_size);
+ strlcpy(buffer, "Hidden DOS 16-bit FAT >=32M", buffer_size);
break;
case 0x17:
- strncpy(buffer, "Hidden IFS (e.g., HPFS)", buffer_size);
+ strlcpy(buffer, "Hidden IFS (e.g., HPFS)", buffer_size);
break;
case 0x18:
- strncpy(buffer, "AST SmartSleep Partition", buffer_size);
+ strlcpy(buffer, "AST SmartSleep Partition", buffer_size);
break;
case 0x19:
- strncpy(buffer, "Unused (Claimed for Willowtech Photon COS)",
+ strlcpy(buffer, "Unused (Claimed for Willowtech Photon COS)",
buffer_size);
break;
case 0x1b:
- strncpy(buffer, "Hidden WIN95 OSR2 32-bit FAT", buffer_size);
+ strlcpy(buffer, "Hidden WIN95 OSR2 32-bit FAT", buffer_size);
break;
case 0x1c:
- strncpy(buffer, "Hidden WIN95 OSR2 32-bit FAT, LBA-mapped",
+ strlcpy(buffer, "Hidden WIN95 OSR2 32-bit FAT, LBA-mapped",
buffer_size);
break;
case 0x1e:
- strncpy(buffer, "Hidden WIN95 16-bit FAT, LBA-mapped", buffer_size);
+ strlcpy(buffer, "Hidden WIN95 16-bit FAT, LBA-mapped", buffer_size);
break;
case 0x20:
- strncpy(buffer, "Unused", buffer_size);
+ strlcpy(buffer, "Unused", buffer_size);
break;
case 0x21:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
- //case 0x21: strncpy(buffer, "Unused", buffer_size); break;
+ //case 0x21: strlcpy(buffer, "Unused", buffer_size); break;
case 0x22:
- strncpy(buffer, "Unused", buffer_size);
+ strlcpy(buffer, "Unused", buffer_size);
break;
case 0x23:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x24:
- strncpy(buffer, "NEC DOS 3.x", buffer_size);
+ strlcpy(buffer, "NEC DOS 3.x", buffer_size);
break;
case 0x26:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x31:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x32:
- strncpy(buffer, "NOS", buffer_size);
+ strlcpy(buffer, "NOS", buffer_size);
break;
case 0x33:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x34:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x35:
- strncpy(buffer, "JFS on OS/2 or eCS", buffer_size);
+ strlcpy(buffer, "JFS on OS/2 or eCS", buffer_size);
break;
case 0x36:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x38:
- strncpy(buffer, "THEOS ver 3.2 2gb partition", buffer_size);
+ strlcpy(buffer, "THEOS ver 3.2 2gb partition", buffer_size);
break;
case 0x39:
- strncpy(buffer, "Plan 9 partition", buffer_size);
+ strlcpy(buffer, "Plan 9 partition", buffer_size);
break;
- //case 0x39: strncpy(buffer, "THEOS ver 4 spanned partition", buffer_size); break;
+ //case 0x39: strlcpy(buffer, "THEOS ver 4 spanned partition", buffer_size); break;
case 0x3a:
- strncpy(buffer, "THEOS ver 4 4gb partition", buffer_size);
+ strlcpy(buffer, "THEOS ver 4 4gb partition", buffer_size);
break;
case 0x3b:
- strncpy(buffer, "THEOS ver 4 extended partition", buffer_size);
+ strlcpy(buffer, "THEOS ver 4 extended partition", buffer_size);
break;
case 0x3c:
- strncpy(buffer, "PartitionMagic recovery partition", buffer_size);
+ strlcpy(buffer, "PartitionMagic recovery partition", buffer_size);
break;
case 0x3d:
- strncpy(buffer, "Hidden NetWare", buffer_size);
+ strlcpy(buffer, "Hidden NetWare", buffer_size);
break;
case 0x40:
- strncpy(buffer, "Venix 80286", buffer_size);
+ strlcpy(buffer, "Venix 80286", buffer_size);
break;
case 0x41:
- strncpy(buffer, "Linux/MINIX (sharing disk with DRDOS)", buffer_size);
+ strlcpy(buffer, "Linux/MINIX (sharing disk with DRDOS)", buffer_size);
break;
- //case 0x41: strncpy(buffer, "Personal RISC Boot", buffer_size); break;
- //case 0x41: strncpy(buffer, "PPC PReP (Power PC Reference Platform) Boot", buffer_size); break;
+ //case 0x41: strlcpy(buffer, "Personal RISC Boot", buffer_size); break;
+ //case 0x41: strlcpy(buffer, "PPC PReP (Power PC Reference Platform) Boot", buffer_size); break;
case 0x42:
- strncpy(buffer, "Linux swap (sharing disk with DRDOS)", buffer_size);
+ strlcpy(buffer, "Linux swap (sharing disk with DRDOS)", buffer_size);
break;
- //case 0x42: strncpy(buffer, "SFS (Secure Filesystem)", buffer_size); break;
- //case 0x42: strncpy(buffer, "Windows 2000 marker", buffer_size); break;
+ //case 0x42: strlcpy(buffer, "SFS (Secure Filesystem)", buffer_size); break;
+ //case 0x42: strlcpy(buffer, "Windows 2000 marker", buffer_size); break;
case 0x43:
- strncpy(buffer, "Linux native (sharing disk with DRDOS)", buffer_size);
+ strlcpy(buffer, "Linux native (sharing disk with DRDOS)", buffer_size);
break;
case 0x44:
- strncpy(buffer, "GoBack partition", buffer_size);
+ strlcpy(buffer, "GoBack partition", buffer_size);
break;
case 0x45:
- strncpy(buffer, "Boot-US boot manager", buffer_size);
+ strlcpy(buffer, "Boot-US boot manager", buffer_size);
break;
- //case 0x45: strncpy(buffer, "Priam", buffer_size); break;
- //case 0x45: strncpy(buffer, "EUMEL/Elan", buffer_size); break;
+ //case 0x45: strlcpy(buffer, "Priam", buffer_size); break;
+ //case 0x45: strlcpy(buffer, "EUMEL/Elan", buffer_size); break;
case 0x46:
- strncpy(buffer, "EUMEL/Elan", buffer_size);
+ strlcpy(buffer, "EUMEL/Elan", buffer_size);
break;
case 0x47:
- strncpy(buffer, "EUMEL/Elan", buffer_size);
+ strlcpy(buffer, "EUMEL/Elan", buffer_size);
break;
case 0x48:
- strncpy(buffer, "EUMEL/Elan", buffer_size);
+ strlcpy(buffer, "EUMEL/Elan", buffer_size);
break;
case 0x4a:
- strncpy(buffer, "AdaOS Aquila (Default)", buffer_size);
+ strlcpy(buffer, "AdaOS Aquila (Default)", buffer_size);
break;
- //case 0x4a: strncpy(buffer, "ALFS/THIN lightweight filesystem for DOS", buffer_size); break;
+ //case 0x4a: strlcpy(buffer, "ALFS/THIN lightweight filesystem for DOS", buffer_size); break;
case 0x4c:
- strncpy(buffer, "Oberon partition", buffer_size);
+ strlcpy(buffer, "Oberon partition", buffer_size);
break;
case 0x4d:
- strncpy(buffer, "QNX4.x", buffer_size);
+ strlcpy(buffer, "QNX4.x", buffer_size);
break;
case 0x4e:
- strncpy(buffer, "QNX4.x 2nd part", buffer_size);
+ strlcpy(buffer, "QNX4.x 2nd part", buffer_size);
break;
case 0x4f:
- strncpy(buffer, "QNX4.x 3rd part", buffer_size);
+ strlcpy(buffer, "QNX4.x 3rd part", buffer_size);
break;
- //case 0x4f: strncpy(buffer, "Oberon partition", buffer_size); break;
+ //case 0x4f: strlcpy(buffer, "Oberon partition", buffer_size); break;
case 0x50:
- strncpy(buffer, "OnTrack Disk Manager (older versions) RO",
+ strlcpy(buffer, "OnTrack Disk Manager (older versions) RO",
buffer_size);
break;
- //case 0x50: strncpy(buffer, "Lynx RTOS", buffer_size); break;
- //case 0x50: strncpy(buffer, "Native Oberon (alt)", buffer_size); break;
+ //case 0x50: strlcpy(buffer, "Lynx RTOS", buffer_size); break;
+ //case 0x50: strlcpy(buffer, "Native Oberon (alt)", buffer_size); break;
case 0x51:
- strncpy(buffer, "OnTrack Disk Manager RW (DM6 Aux1)", buffer_size);
+ strlcpy(buffer, "OnTrack Disk Manager RW (DM6 Aux1)", buffer_size);
break;
- //case 0x51: strncpy(buffer, "Novell", buffer_size); break;
+ //case 0x51: strlcpy(buffer, "Novell", buffer_size); break;
case 0x52:
- strncpy(buffer, "CP/M", buffer_size);
+ strlcpy(buffer, "CP/M", buffer_size);
break;
- //case 0x52: strncpy(buffer, "Microport SysV/AT", buffer_size); break;
+ //case 0x52: strlcpy(buffer, "Microport SysV/AT", buffer_size); break;
case 0x53:
- strncpy(buffer, "Disk Manager 6.0 Aux3", buffer_size);
+ strlcpy(buffer, "Disk Manager 6.0 Aux3", buffer_size);
break;
case 0x54:
- strncpy(buffer, "Disk Manager 6.0 Dynamic Drive Overlay", buffer_size);
+ strlcpy(buffer, "Disk Manager 6.0 Dynamic Drive Overlay", buffer_size);
break;
case 0x55:
- strncpy(buffer, "EZ-Drive", buffer_size);
+ strlcpy(buffer, "EZ-Drive", buffer_size);
break;
case 0x56:
- strncpy(buffer, "Golden Bow VFeature Partitioned Volume.", buffer_size);
+ strlcpy(buffer, "Golden Bow VFeature Partitioned Volume.", buffer_size);
break;
- //case 0x56: strncpy(buffer, "DM converted to EZ-BIOS", buffer_size); break;
+ //case 0x56: strlcpy(buffer, "DM converted to EZ-BIOS", buffer_size); break;
case 0x57:
- strncpy(buffer, "DrivePro", buffer_size);
+ strlcpy(buffer, "DrivePro", buffer_size);
break;
- //case 0x57: strncpy(buffer, "VNDI Partition", buffer_size); break;
+ //case 0x57: strlcpy(buffer, "VNDI Partition", buffer_size); break;
case 0x5c:
- strncpy(buffer, "Priam EDisk", buffer_size);
+ strlcpy(buffer, "Priam EDisk", buffer_size);
break;
case 0x61:
- strncpy(buffer, "SpeedStor", buffer_size);
+ strlcpy(buffer, "SpeedStor", buffer_size);
break;
case 0x63:
- strncpy(buffer,
+ strlcpy(buffer,
"Unix System V (SCO, ISC Unix, UnixWare, ...), Mach, GNU Hurd",
buffer_size);
break;
case 0x64:
- strncpy(buffer, "PC-ARMOUR protected partition", buffer_size);
+ strlcpy(buffer, "PC-ARMOUR protected partition", buffer_size);
break;
- //case 0x64: strncpy(buffer, "Novell Netware 286, 2.xx", buffer_size); break;
+ //case 0x64: strlcpy(buffer, "Novell Netware 286, 2.xx", buffer_size); break;
case 0x65:
- strncpy(buffer, "Novell Netware 386, 3.xx or 4.xx", buffer_size);
+ strlcpy(buffer, "Novell Netware 386, 3.xx or 4.xx", buffer_size);
break;
case 0x66:
- strncpy(buffer, "Novell Netware SMS Partition", buffer_size);
+ strlcpy(buffer, "Novell Netware SMS Partition", buffer_size);
break;
case 0x67:
- strncpy(buffer, "Novell", buffer_size);
+ strlcpy(buffer, "Novell", buffer_size);
break;
case 0x68:
- strncpy(buffer, "Novell", buffer_size);
+ strlcpy(buffer, "Novell", buffer_size);
break;
case 0x69:
- strncpy(buffer, "Novell Netware 5+, Novell Netware NSS Partition",
+ strlcpy(buffer, "Novell Netware 5+, Novell Netware NSS Partition",
buffer_size);
break;
case 0x70:
- strncpy(buffer, "DiskSecure Multi-Boot", buffer_size);
+ strlcpy(buffer, "DiskSecure Multi-Boot", buffer_size);
break;
case 0x71:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x73:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x74:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
- //case 0x74: strncpy(buffer, "Scramdisk partition", buffer_size); break;
+ //case 0x74: strlcpy(buffer, "Scramdisk partition", buffer_size); break;
case 0x75:
- strncpy(buffer, "IBM PC/IX", buffer_size);
+ strlcpy(buffer, "IBM PC/IX", buffer_size);
break;
case 0x76:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x77:
- strncpy(buffer, "M2FS/M2CS partition", buffer_size);
+ strlcpy(buffer, "M2FS/M2CS partition", buffer_size);
break;
- //case 0x77: strncpy(buffer, "VNDI Partition", buffer_size); break;
+ //case 0x77: strlcpy(buffer, "VNDI Partition", buffer_size); break;
case 0x78:
- strncpy(buffer, "XOSL FS", buffer_size);
+ strlcpy(buffer, "XOSL FS", buffer_size);
break;
case 0x7E:
- strncpy(buffer, " ", buffer_size);
+ strlcpy(buffer, " ", buffer_size);
break;
case 0x80:
- strncpy(buffer, "MINIX until 1.4a", buffer_size);
+ strlcpy(buffer, "MINIX until 1.4a", buffer_size);
break;
case 0x81:
- strncpy(buffer, "MINIX since 1.4b, early Linux", buffer_size);
+ strlcpy(buffer, "MINIX since 1.4b, early Linux", buffer_size);
break;
- //case 0x81: strncpy(buffer, "Mitac disk manager", buffer_size); break;
- //case 0x82: strncpy(buffer, "Prime", buffer_size); break;
- //case 0x82: strncpy(buffer, "Solaris x86", buffer_size); break;
+ //case 0x81: strlcpy(buffer, "Mitac disk manager", buffer_size); break;
+ //case 0x82: strlcpy(buffer, "Prime", buffer_size); break;
+ //case 0x82: strlcpy(buffer, "Solaris x86", buffer_size); break;
case 0x82:
- strncpy(buffer, "Linux swap", buffer_size);
+ strlcpy(buffer, "Linux swap", buffer_size);
break;
case 0x83:
- strncpy(buffer, "Linux native (usually ext2fs)", buffer_size);
+ strlcpy(buffer, "Linux native (usually ext2fs)", buffer_size);
break;
case 0x84:
- strncpy(buffer, "OS/2 hidden C: drive", buffer_size);
+ strlcpy(buffer, "OS/2 hidden C: drive", buffer_size);
break;
- //case 0x84: strncpy(buffer, "Hibernation partition", buffer_size); break;
+ //case 0x84: strlcpy(buffer, "Hibernation partition", buffer_size); break;
case 0x85:
- strncpy(buffer, "Linux extended partition", buffer_size);
+ strlcpy(buffer, "Linux extended partition", buffer_size);
break;
- //case 0x86: strncpy(buffer, "Old Linux RAID partition superblock", buffer_size); break;
+ //case 0x86: strlcpy(buffer, "Old Linux RAID partition superblock", buffer_size); break;
case 0x86:
- strncpy(buffer, "NTFS volume set", buffer_size);
+ strlcpy(buffer, "NTFS volume set", buffer_size);
break;
case 0x87:
- strncpy(buffer, "NTFS volume set", buffer_size);
+ strlcpy(buffer, "NTFS volume set", buffer_size);
break;
case 0x8a:
- strncpy(buffer, "Linux Kernel Partition (used by AiR-BOOT)",
+ strlcpy(buffer, "Linux Kernel Partition (used by AiR-BOOT)",
buffer_size);
break;
case 0x8b:
- strncpy(buffer, "Legacy Fault Tolerant FAT32 volume", buffer_size);
+ strlcpy(buffer, "Legacy Fault Tolerant FAT32 volume", buffer_size);
break;
case 0x8c:
- strncpy(buffer,
+ strlcpy(buffer,
"Legacy Fault Tolerant FAT32 volume using BIOS extd INT 13h",
buffer_size);
break;
case 0x8d:
- strncpy(buffer, "Free FDISK hidden Primary DOS FAT12 partitition",
+ strlcpy(buffer, "Free FDISK hidden Primary DOS FAT12 partitition",
buffer_size);
break;
case 0x8e:
- strncpy(buffer, "Linux Logical Volume Manager partition", buffer_size);
+ strlcpy(buffer, "Linux Logical Volume Manager partition", buffer_size);
break;
case 0x90:
- strncpy(buffer, "Free FDISK hidden Primary DOS FAT16 partitition",
+ strlcpy(buffer, "Free FDISK hidden Primary DOS FAT16 partitition",
buffer_size);
break;
case 0x91:
- strncpy(buffer, "Free FDISK hidden DOS extended partitition",
+ strlcpy(buffer, "Free FDISK hidden DOS extended partitition",
buffer_size);
break;
case 0x92:
- strncpy(buffer, "Free FDISK hidden Primary DOS large FAT16 partitition",
+ strlcpy(buffer, "Free FDISK hidden Primary DOS large FAT16 partitition",
buffer_size);
break;
case 0x93:
- strncpy(buffer, "Hidden Linux native partition", buffer_size);
+ strlcpy(buffer, "Hidden Linux native partition", buffer_size);
break;
- //case 0x93: strncpy(buffer, "Amoeba", buffer_size); break;
+ //case 0x93: strlcpy(buffer, "Amoeba", buffer_size); break;
case 0x94:
- strncpy(buffer, "Amoeba bad block table", buffer_size);
+ strlcpy(buffer, "Amoeba bad block table", buffer_size);
break;
case 0x95:
- strncpy(buffer, "MIT EXOPC native partitions", buffer_size);
+ strlcpy(buffer, "MIT EXOPC native partitions", buffer_size);
break;
case 0x97:
- strncpy(buffer, "Free FDISK hidden Primary DOS FAT32 partitition",
+ strlcpy(buffer, "Free FDISK hidden Primary DOS FAT32 partitition",
buffer_size);
break;
case 0x98:
- strncpy(buffer, "Free FDISK hidden Primary DOS FAT32 partitition (LBA)",
+ strlcpy(buffer, "Free FDISK hidden Primary DOS FAT32 partitition (LBA)",
buffer_size);
break;
case 0x99:
- strncpy(buffer, "DCE376 logical drive", buffer_size);
+ strlcpy(buffer, "DCE376 logical drive", buffer_size);
break;
case 0x9a:
- strncpy(buffer, "Free FDISK hidden Primary DOS FAT16 partitition (LBA)",
+ strlcpy(buffer, "Free FDISK hidden Primary DOS FAT16 partitition (LBA)",
buffer_size);
break;
case 0x9b:
- strncpy(buffer, "Free FDISK hidden DOS extended partitition (LBA)",
+ strlcpy(buffer, "Free FDISK hidden DOS extended partitition (LBA)",
buffer_size);
break;
case 0x9f:
- strncpy(buffer, "BSD/OS", buffer_size);
+ strlcpy(buffer, "BSD/OS", buffer_size);
break;
case 0xa0:
- strncpy(buffer, "Laptop hibernation partition", buffer_size);
+ strlcpy(buffer, "Laptop hibernation partition", buffer_size);
break;
case 0xa1:
- strncpy(buffer, "Laptop hibernation partition", buffer_size);
+ strlcpy(buffer, "Laptop hibernation partition", buffer_size);
break;
- //case 0xa1: strncpy(buffer, "HP Volume Expansion (SpeedStor variant)", buffer_size); break;
+ //case 0xa1: strlcpy(buffer, "HP Volume Expansion (SpeedStor variant)", buffer_size); break;
case 0xa3:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0xa4:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0xa5:
- strncpy(buffer, "BSD/386, 386BSD, NetBSD, FreeBSD", buffer_size);
+ strlcpy(buffer, "BSD/386, 386BSD, NetBSD, FreeBSD", buffer_size);
break;
case 0xa6:
- strncpy(buffer, "OpenBSD", buffer_size);
+ strlcpy(buffer, "OpenBSD", buffer_size);
break;
case 0xa7:
- strncpy(buffer, "NEXTSTEP", buffer_size);
+ strlcpy(buffer, "NEXTSTEP", buffer_size);
break;
case 0xa8:
- strncpy(buffer, "Mac OS-X", buffer_size);
+ strlcpy(buffer, "Mac OS-X", buffer_size);
break;
case 0xa9:
- strncpy(buffer, "NetBSD", buffer_size);
+ strlcpy(buffer, "NetBSD", buffer_size);
break;
case 0xaa:
- strncpy(buffer, "Olivetti Fat 12 1.44Mb Service Partition",
+ strlcpy(buffer, "Olivetti Fat 12 1.44Mb Service Partition",
buffer_size);
break;
case 0xab:
- strncpy(buffer, "Mac OS-X Boot partition", buffer_size);
+ strlcpy(buffer, "Mac OS-X Boot partition", buffer_size);
break;
- //case 0xab: strncpy(buffer, "GO! partition", buffer_size); break;
+ //case 0xab: strlcpy(buffer, "GO! partition", buffer_size); break;
case 0xae:
- strncpy(buffer, "ShagOS filesystem", buffer_size);
+ strlcpy(buffer, "ShagOS filesystem", buffer_size);
break;
case 0xaf:
- strncpy(buffer, "ShagOS swap partition", buffer_size);
+ strlcpy(buffer, "ShagOS swap partition", buffer_size);
break;
case 0xb0:
- strncpy(buffer, "BootStar Dummy", buffer_size);
+ strlcpy(buffer, "BootStar Dummy", buffer_size);
break;
case 0xb1:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0xb3:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0xb4:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0xb6:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0xb7:
- strncpy(buffer, "BSDI BSD/386 filesystem", buffer_size);
+ strlcpy(buffer, "BSDI BSD/386 filesystem", buffer_size);
break;
case 0xb8:
- strncpy(buffer, "BSDI BSD/386 swap partition", buffer_size);
+ strlcpy(buffer, "BSDI BSD/386 swap partition", buffer_size);
break;
case 0xbb:
- strncpy(buffer, "Boot Wizard hidden", buffer_size);
+ strlcpy(buffer, "Boot Wizard hidden", buffer_size);
break;
case 0xbe:
- strncpy(buffer, "Solaris 8 boot partition", buffer_size);
+ strlcpy(buffer, "Solaris 8 boot partition", buffer_size);
break;
case 0xc0:
- strncpy(buffer, "CTOS", buffer_size);
+ strlcpy(buffer, "CTOS", buffer_size);
break;
- //case 0xc0: strncpy(buffer, "REAL/32 secure small partition", buffer_size); break;
- //case 0xc0: strncpy(buffer, "NTFT Partition", buffer_size); break;
+ //case 0xc0: strlcpy(buffer, "REAL/32 secure small partition", buffer_size); break;
+ //case 0xc0: strlcpy(buffer, "NTFT Partition", buffer_size); break;
case 0xc1:
- strncpy(buffer, "DRDOS/secured (FAT-12)", buffer_size);
+ strlcpy(buffer, "DRDOS/secured (FAT-12)", buffer_size);
break;
case 0xc2:
- strncpy(buffer, "Reserved for DR-DOS 7+", buffer_size);
+ strlcpy(buffer, "Reserved for DR-DOS 7+", buffer_size);
break;
- //case 0xc2: strncpy(buffer, "Hidden Linux", buffer_size); break;
+ //case 0xc2: strlcpy(buffer, "Hidden Linux", buffer_size); break;
case 0xc3:
- strncpy(buffer, "Hidden Linux swap", buffer_size);
+ strlcpy(buffer, "Hidden Linux swap", buffer_size);
break;
case 0xc4:
- strncpy(buffer, "DRDOS/secured (FAT-16, < 32M)", buffer_size);
+ strlcpy(buffer, "DRDOS/secured (FAT-16, < 32M)", buffer_size);
break;
case 0xc5:
- strncpy(buffer, "DRDOS/secured (extended)", buffer_size);
+ strlcpy(buffer, "DRDOS/secured (extended)", buffer_size);
break;
case 0xc6:
- strncpy(buffer, "DRDOS/secured (FAT-16, >= 32M)", buffer_size);
+ strlcpy(buffer, "DRDOS/secured (FAT-16, >= 32M)", buffer_size);
break;
- //case 0xc6: strncpy(buffer, "Windows NT corrupted FAT16 volume/stripe set", buffer_size); break;
+ //case 0xc6: strlcpy(buffer, "Windows NT corrupted FAT16 volume/stripe set", buffer_size); break;
case 0xc7:
- strncpy(buffer, "Windows NT corrupted NTFS volume/stripe set",
+ strlcpy(buffer, "Windows NT corrupted NTFS volume/stripe set",
buffer_size);
break;
- //case 0xc7: strncpy(buffer, "Syrinx boot", buffer_size); break;
+ //case 0xc7: strlcpy(buffer, "Syrinx boot", buffer_size); break;
case 0xc8:
- strncpy(buffer, "(See also ID c2.)", buffer_size);
+ strlcpy(buffer, "(See also ID c2.)", buffer_size);
break;
case 0xc9:
- strncpy(buffer, "(See also ID c2.)", buffer_size);
+ strlcpy(buffer, "(See also ID c2.)", buffer_size);
break;
case 0xca:
- strncpy(buffer, "(See also ID c2.)", buffer_size);
+ strlcpy(buffer, "(See also ID c2.)", buffer_size);
break;
case 0xcb:
- strncpy(buffer, "reserved for DRDOS/secured (FAT32)", buffer_size);
+ strlcpy(buffer, "reserved for DRDOS/secured (FAT32)", buffer_size);
break;
case 0xcc:
- strncpy(buffer, "reserved for DRDOS/secured (FAT32, LBA)", buffer_size);
+ strlcpy(buffer, "reserved for DRDOS/secured (FAT32, LBA)", buffer_size);
break;
case 0xcd:
- strncpy(buffer, "CTOS Memdump?", buffer_size);
+ strlcpy(buffer, "CTOS Memdump?", buffer_size);
break;
case 0xce:
- strncpy(buffer, "reserved for DRDOS/secured (FAT16, LBA)", buffer_size);
+ strlcpy(buffer, "reserved for DRDOS/secured (FAT16, LBA)", buffer_size);
break;
case 0xd0:
- strncpy(buffer, "REAL/32 secure big partition", buffer_size);
+ strlcpy(buffer, "REAL/32 secure big partition", buffer_size);
break;
case 0xd1:
- strncpy(buffer, "Old Multiuser DOS secured FAT12", buffer_size);
+ strlcpy(buffer, "Old Multiuser DOS secured FAT12", buffer_size);
break;
case 0xd4:
- strncpy(buffer, "Old Multiuser DOS secured FAT16 <32M", buffer_size);
+ strlcpy(buffer, "Old Multiuser DOS secured FAT16 <32M", buffer_size);
break;
case 0xd5:
- strncpy(buffer, "Old Multiuser DOS secured extended partition",
+ strlcpy(buffer, "Old Multiuser DOS secured extended partition",
buffer_size);
break;
case 0xd6:
- strncpy(buffer, "Old Multiuser DOS secured FAT16 >=32M", buffer_size);
+ strlcpy(buffer, "Old Multiuser DOS secured FAT16 >=32M", buffer_size);
break;
case 0xd8:
- strncpy(buffer, "CP/M-86", buffer_size);
+ strlcpy(buffer, "CP/M-86", buffer_size);
break;
case 0xda:
- strncpy(buffer, "Non-FS Data", buffer_size);
+ strlcpy(buffer, "Non-FS Data", buffer_size);
break;
case 0xdb:
- strncpy(buffer,
+ strlcpy(buffer,
"Digital Research CP/M, Concurrent CP/M, Concurrent DOS",
buffer_size);
break;
- //case 0xdb: strncpy(buffer, "CTOS (Convergent Technologies OS -Unisys)", buffer_size); break;
- //case 0xdb: strncpy(buffer, "KDG Telemetry SCPU boot", buffer_size); break;
+ //case 0xdb: strlcpy(buffer, "CTOS (Convergent Technologies OS -Unisys)", buffer_size); break;
+ //case 0xdb: strlcpy(buffer, "KDG Telemetry SCPU boot", buffer_size); break;
case 0xdd:
- strncpy(buffer, "Hidden CTOS Memdump?", buffer_size);
+ strlcpy(buffer, "Hidden CTOS Memdump?", buffer_size);
break;
case 0xde:
- strncpy(buffer, "Dell PowerEdge Server utilities (FAT fs)",
+ strlcpy(buffer, "Dell PowerEdge Server utilities (FAT fs)",
buffer_size);
break;
case 0xdf:
- strncpy(buffer, "DG/UX virtual disk manager partition", buffer_size);
+ strlcpy(buffer, "DG/UX virtual disk manager partition", buffer_size);
break;
- //case 0xdf: strncpy(buffer, "BootIt EMBRM", buffer_size); break;
+ //case 0xdf: strlcpy(buffer, "BootIt EMBRM", buffer_size); break;
case 0xe0:
- strncpy(buffer,
+ strlcpy(buffer,
"Reserved by STMicroelectronics for a filesystem called ST AVFS.",
buffer_size);
break;
case 0xe1:
- strncpy(buffer, "DOS access or SpeedStor 12-bit FAT extended partition",
+ strlcpy(buffer, "DOS access or SpeedStor 12-bit FAT extended partition",
buffer_size);
break;
case 0xe3:
- strncpy(buffer, "DOS R/O or SpeedStor", buffer_size);
+ strlcpy(buffer, "DOS R/O or SpeedStor", buffer_size);
break;
case 0xe4:
- strncpy(buffer, "SpeedStor 16-bit FAT extended partition < 1024 cyl.",
+ strlcpy(buffer, "SpeedStor 16-bit FAT extended partition < 1024 cyl.",
buffer_size);
break;
case 0xe5:
- strncpy(buffer,
+ strlcpy(buffer,
"Tandy DOS with logical sectored FAT (According to Powerquest.)",
buffer_size);
break;
- //case 0xe5: strncpy(buffer, "Reserved", buffer_size); break;
+ //case 0xe5: strlcpy(buffer, "Reserved", buffer_size); break;
case 0xe6:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0xeb:
- strncpy(buffer, "BFS (aka BeFS)", buffer_size);
+ strlcpy(buffer, "BFS (aka BeFS)", buffer_size);
break;
case 0xed:
- strncpy(buffer, "Reserved for Matthias Paul's Sprytix", buffer_size);
+ strlcpy(buffer, "Reserved for Matthias Paul's Sprytix", buffer_size);
break;
case 0xee:
- strncpy(buffer,
+ strlcpy(buffer,
"Indication that this legacy MBR is followed by an EFI header",
buffer_size);
break;
case 0xef:
- strncpy(buffer, "Partition that contains an EFI file system",
+ strlcpy(buffer, "Partition that contains an EFI file system",
buffer_size);
break;
case 0xf0:
- strncpy(buffer, "Linux/PA-RISC boot loader", buffer_size);
+ strlcpy(buffer, "Linux/PA-RISC boot loader", buffer_size);
break;
case 0xf1:
- strncpy(buffer, "SpeedStor", buffer_size);
+ strlcpy(buffer, "SpeedStor", buffer_size);
break;
case 0xf2:
- strncpy(buffer,
+ strlcpy(buffer,
"DOS 3.3+ secondary partition (Powerquest writes: Unisys DOS with logical sectored FAT.)",
buffer_size);
break;
case 0xf3:
- strncpy(buffer,
+ strlcpy(buffer,
"Reserved (Powerquest writes: Storage Dimensions SpeedStor.)",
buffer_size);
break;
case 0xf4:
- strncpy(buffer, "SpeedStor large partition", buffer_size);
+ strlcpy(buffer, "SpeedStor large partition", buffer_size);
break;
- //case 0xf4: strncpy(buffer, "Prologue single-volume partition", buffer_size); break;
+ //case 0xf4: strlcpy(buffer, "Prologue single-volume partition", buffer_size); break;
case 0xf5:
- strncpy(buffer, "Prologue multi-volume partition", buffer_size);
+ strlcpy(buffer, "Prologue multi-volume partition", buffer_size);
break;
case 0xf6:
- strncpy(buffer,
+ strlcpy(buffer,
"Reserved (Powerquest writes: Storage Dimensions SpeedStor. )",
buffer_size);
break;
case 0xfa:
- strncpy(buffer, "Bochs", buffer_size);
+ strlcpy(buffer, "Bochs", buffer_size);
break;
case 0xfb:
- strncpy(buffer, "VMware File System partition", buffer_size);
+ strlcpy(buffer, "VMware File System partition", buffer_size);
break;
case 0xfc:
- strncpy(buffer, "VMware Swap partition", buffer_size);
+ strlcpy(buffer, "VMware Swap partition", buffer_size);
break;
case 0xfd:
- strncpy(buffer,
+ strlcpy(buffer,
"Linux raid partition with autodetect using persistent superblock (Powerquest writes: Reserved for FreeDOS. )",
buffer_size);
break;
case 0xfe:
- strncpy(buffer, "SpeedStor > 1024 cyl.", buffer_size);
+ strlcpy(buffer, "SpeedStor > 1024 cyl.", buffer_size);
break;
- //case 0xfe: strncpy(buffer, "LANstep", buffer_size); break;
- //case 0xfe: strncpy(buffer, "IBM PS/2 IML (Initial Microcode Load) partition, located at the end of the disk.", buffer_size); break;
- //case 0xfe: strncpy(buffer, "Windows NT Disk Administrator hidden partition", buffer_size); break;
- //case 0xfe: strncpy(buffer, "Linux Logical Volume Manager partition (old)", buffer_size); break;
+ //case 0xfe: strlcpy(buffer, "LANstep", buffer_size); break;
+ //case 0xfe: strlcpy(buffer, "IBM PS/2 IML (Initial Microcode Load) partition, located at the end of the disk.", buffer_size); break;
+ //case 0xfe: strlcpy(buffer, "Windows NT Disk Administrator hidden partition", buffer_size); break;
+ //case 0xfe: strlcpy(buffer, "Linux Logical Volume Manager partition (old)", buffer_size); break;
case 0xff:
- strncpy(buffer, "Xenix Bad Block Table ", buffer_size);
+ strlcpy(buffer, "Xenix Bad Block Table ", buffer_size);
break;
default:
- strncpy(buffer, "Unknown", buffer_size);
+ strlcpy(buffer, "Unknown", buffer_size);
break;
}
}
diff --git a/com32/gpllib/disk/mbrs.c b/com32/gpllib/disk/mbrs.c
index b468f791..f2942fcb 100644
--- a/com32/gpllib/disk/mbrs.c
+++ b/com32/gpllib/disk/mbrs.c
@@ -30,73 +30,73 @@ void get_mbr_string(const uint32_t label, char *buffer, const int buffer_size)
case 0xfa33:
case 0xfab8:
case 0xfabe:
- strncpy(buffer, "No bootloader", buffer_size - 1);
+ strlcpy(buffer, "No bootloader", buffer_size - 1);
break;
case 0x0ebe:
- strncpy(buffer, "ThinkPad", buffer_size - 1);
+ strlcpy(buffer, "ThinkPad", buffer_size - 1);
break;
case 0x31c0:
- strncpy(buffer, "Acer 3", buffer_size - 1);
+ strlcpy(buffer, "Acer 3", buffer_size - 1);
break;
case 0x33c0:
- strncpy(buffer, "Windows", buffer_size - 1);
+ strlcpy(buffer, "Windows", buffer_size - 1);
break;
case 0x33ff:
- strncpy(buffer, "HP/Gateway", buffer_size - 1);
+ strlcpy(buffer, "HP/Gateway", buffer_size - 1);
break;
case 0xb800:
- strncpy(buffer, "PloP", buffer_size - 1);
+ strlcpy(buffer, "PloP", buffer_size - 1);
break;
case 0xea05:
- strncpy(buffer, "XOSL", buffer_size - 1);
+ strlcpy(buffer, "XOSL", buffer_size - 1);
break;
case 0xea1e:
- strncpy(buffer, "Truecrypt Boot Loader", buffer_size - 1);
+ strlcpy(buffer, "Truecrypt Boot Loader", buffer_size - 1);
break;
case 0xeb04:
- strncpy(buffer, "Solaris", buffer_size - 1);
+ strlcpy(buffer, "Solaris", buffer_size - 1);
break;
case 0xeb48:
- strncpy(buffer, "Grub", buffer_size - 1);
+ strlcpy(buffer, "Grub", buffer_size - 1);
break;
case 0xeb4c:
- strncpy(buffer, "Grub2 (v1.96)", buffer_size - 1);
+ strlcpy(buffer, "Grub2 (v1.96)", buffer_size - 1);
break;
case 0xeb63:
- strncpy(buffer, "Grub2 (v1.97)", buffer_size - 1);
+ strlcpy(buffer, "Grub2 (v1.97)", buffer_size - 1);
break;
case 0xeb5e:
/* We need more than 2 bytes */
if (((label >> 8) & 0xff) == 0x00)
- strncpy(buffer, "fbinst", buffer_size - 1);
+ strlcpy(buffer, "fbinst", buffer_size - 1);
else if (((label >> 8) & 0xff) == 0x80)
- strncpy(buffer, "Grub4Dos", buffer_size - 1);
+ strlcpy(buffer, "Grub4Dos", buffer_size - 1);
else
- strncpy(buffer, "Unknown mbr", buffer_size - 1);
+ strlcpy(buffer, "Unknown mbr", buffer_size - 1);
break;
case 0xfa31:
/* We need more than 2 bytes */
if (((label >> 8) & 0xff) == 0xc9)
- strncpy(buffer, "Master Boot LoaDeR", buffer_size - 1);
+ strlcpy(buffer, "Master Boot LoaDeR", buffer_size - 1);
else if (((label >> 8) & 0xff) == 0xc0)
- strncpy(buffer, "Syslinux", buffer_size - 1);
+ strlcpy(buffer, "Syslinux", buffer_size - 1);
else
- strncpy(buffer, "Unknown mbr", buffer_size - 1);
+ strlcpy(buffer, "Unknown mbr", buffer_size - 1);
break;
case 0xfaeb:
- strncpy(buffer, "Lilo", buffer_size - 1);
+ strlcpy(buffer, "Lilo", buffer_size - 1);
break;
case 0xfc31:
- strncpy(buffer, "Testdisk", buffer_size - 1);
+ strlcpy(buffer, "Testdisk", buffer_size - 1);
break;
case 0xfc33:
- strncpy(buffer, "GAG", buffer_size - 1);
+ strlcpy(buffer, "GAG", buffer_size - 1);
break;
case 0xfceb:
- strncpy(buffer, "BootIT NG", buffer_size - 1);
+ strlcpy(buffer, "BootIT NG", buffer_size - 1);
break;
default:
- strncpy(buffer, "Unknown mbr", buffer_size - 1);
+ strlcpy(buffer, "Unknown mbr", buffer_size - 1);
break;
}
diff --git a/com32/gpllib/dmi/dmi.c b/com32/gpllib/dmi/dmi.c
index d333b9ab..cd72fbb6 100644
--- a/com32/gpllib/dmi/dmi.c
+++ b/com32/gpllib/dmi/dmi.c
@@ -73,11 +73,11 @@ static void dmi_on_board_devices(struct dmi_header *h, s_dmi * dmi)
&& i <
sizeof dmi->base_board.devices_information /
sizeof *dmi->base_board.devices_information; i++) {
- strncpy(dmi->base_board.devices_information[i].type,
+ strlcpy(dmi->base_board.devices_information[i].type,
dmi_on_board_devices_type(p[2 * i] & 0x7F),
sizeof dmi->base_board.devices_information[i].type);
dmi->base_board.devices_information[i].status = p[2 * i] & 0x80;
- strncpy(dmi->base_board.devices_information[i].description,
+ strlcpy(dmi->base_board.devices_information[i].description,
dmi_string(h, p[2 * i + 1]),
sizeof dmi->base_board.devices_information[i].description);
}
@@ -103,7 +103,7 @@ static const char *dmi_system_reset_boot_option(uint8_t code)
static void dmi_system_reset_count(uint16_t code, char *array)
{
if (code == 0xFFFF)
- strncpy(array, "Unknown", sizeof array);
+ strlcpy(array, "Unknown", sizeof array);
else
snprintf(array, sizeof array, "%u", code);
}
@@ -111,7 +111,7 @@ static void dmi_system_reset_count(uint16_t code, char *array)
static void dmi_system_reset_timer(uint16_t code, char *array)
{
if (code == 0xFFFF)
- strncpy(array, "Unknown", sizeof array);
+ strlcpy(array, "Unknown", sizeof array);
else
snprintf(array, sizeof array, "%u min", code);
}
@@ -179,22 +179,22 @@ static void dmi_system_boot_status(uint8_t code, char *array)
};
if (code <= 8)
- strncpy(array, status[code], SYSTEM_BOOT_STATUS_SIZE);
+ strlcpy(array, status[code], SYSTEM_BOOT_STATUS_SIZE);
if (code >= 128 && code <= 191)
- strncpy(array, "OEM-specific", SYSTEM_BOOT_STATUS_SIZE);
+ strlcpy(array, "OEM-specific", SYSTEM_BOOT_STATUS_SIZE);
if (code >= 192)
- strncpy(array, "Product-specific", SYSTEM_BOOT_STATUS_SIZE);
+ strlcpy(array, "Product-specific", SYSTEM_BOOT_STATUS_SIZE);
}
void dmi_bios_runtime_size(uint32_t code, s_dmi * dmi)
{
if (code & 0x000003FF) {
dmi->bios.runtime_size = code;
- strncpy(dmi->bios.runtime_size_unit, "bytes",
+ strlcpy(dmi->bios.runtime_size_unit, "bytes",
sizeof(dmi->bios.runtime_size_unit));
} else {
dmi->bios.runtime_size = code >> 10;
- strncpy(dmi->bios.runtime_size_unit, "KB",
+ strlcpy(dmi->bios.runtime_size_unit, "KB",
sizeof(dmi->bios.runtime_size_unit));
}
@@ -279,10 +279,10 @@ void dmi_system_wake_up_type(uint8_t code, s_dmi * dmi)
};
if (code <= 0x08) {
- strncpy(dmi->system.wakeup_type, type[code],
+ strlcpy(dmi->system.wakeup_type, type[code],
sizeof(dmi->system.wakeup_type));
} else {
- strncpy(dmi->system.wakeup_type, out_of_spec,
+ strlcpy(dmi->system.wakeup_type, out_of_spec,
sizeof(dmi->system.wakeup_type));
}
return;
@@ -579,16 +579,16 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
if (h->length < 0x12)
break;
dmi->bios.filled = true;
- strncpy(dmi->bios.vendor, dmi_string(h, data[0x04]),
+ strlcpy(dmi->bios.vendor, dmi_string(h, data[0x04]),
sizeof(dmi->bios.vendor));
- strncpy(dmi->bios.version, dmi_string(h, data[0x05]),
+ strlcpy(dmi->bios.version, dmi_string(h, data[0x05]),
sizeof(dmi->bios.version));
- strncpy(dmi->bios.release_date, dmi_string(h, data[0x08]),
+ strlcpy(dmi->bios.release_date, dmi_string(h, data[0x08]),
sizeof(dmi->bios.release_date));
dmi->bios.address = WORD(data + 0x06);
dmi_bios_runtime_size((0x10000 - WORD(data + 0x06)) << 4, dmi);
dmi->bios.rom_size = (data[0x09] + 1) << 6;
- strncpy(dmi->bios.rom_size_unit, "kB", sizeof(dmi->bios.rom_size_unit));
+ strlcpy(dmi->bios.rom_size_unit, "kB", sizeof(dmi->bios.rom_size_unit));
dmi_bios_characteristics(QWORD(data + 0x0A), dmi);
if (h->length < 0x13)
@@ -611,13 +611,13 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
if (h->length < 0x08)
break;
dmi->system.filled = true;
- strncpy(dmi->system.manufacturer, dmi_string(h, data[0x04]),
+ strlcpy(dmi->system.manufacturer, dmi_string(h, data[0x04]),
sizeof(dmi->system.manufacturer));
- strncpy(dmi->system.product_name, dmi_string(h, data[0x05]),
+ strlcpy(dmi->system.product_name, dmi_string(h, data[0x05]),
sizeof(dmi->system.product_name));
- strncpy(dmi->system.version, dmi_string(h, data[0x06]),
+ strlcpy(dmi->system.version, dmi_string(h, data[0x06]),
sizeof(dmi->system.version));
- strncpy(dmi->system.serial, dmi_string(h, data[0x07]),
+ strlcpy(dmi->system.serial, dmi_string(h, data[0x07]),
sizeof(dmi->system.serial));
if (h->length < 0x19)
break;
@@ -625,9 +625,9 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
dmi_system_wake_up_type(data[0x18], dmi);
if (h->length < 0x1B)
break;
- strncpy(dmi->system.sku_number, dmi_string(h, data[0x19]),
+ strlcpy(dmi->system.sku_number, dmi_string(h, data[0x19]),
sizeof(dmi->system.sku_number));
- strncpy(dmi->system.family, dmi_string(h, data[0x1A]),
+ strlcpy(dmi->system.family, dmi_string(h, data[0x1A]),
sizeof(dmi->system.family));
break;
@@ -635,22 +635,22 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
if (h->length < 0x08)
break;
dmi->base_board.filled = true;
- strncpy(dmi->base_board.manufacturer, dmi_string(h, data[0x04]),
+ strlcpy(dmi->base_board.manufacturer, dmi_string(h, data[0x04]),
sizeof(dmi->base_board.manufacturer));
- strncpy(dmi->base_board.product_name, dmi_string(h, data[0x05]),
+ strlcpy(dmi->base_board.product_name, dmi_string(h, data[0x05]),
sizeof(dmi->base_board.product_name));
- strncpy(dmi->base_board.version, dmi_string(h, data[0x06]),
+ strlcpy(dmi->base_board.version, dmi_string(h, data[0x06]),
sizeof(dmi->base_board.version));
- strncpy(dmi->base_board.serial, dmi_string(h, data[0x07]),
+ strlcpy(dmi->base_board.serial, dmi_string(h, data[0x07]),
sizeof(dmi->base_board.serial));
if (h->length < 0x0F)
break;
- strncpy(dmi->base_board.asset_tag, dmi_string(h, data[0x08]),
+ strlcpy(dmi->base_board.asset_tag, dmi_string(h, data[0x08]),
sizeof(dmi->base_board.asset_tag));
dmi_base_board_features(data[0x09], dmi);
- strncpy(dmi->base_board.location, dmi_string(h, data[0x0A]),
+ strlcpy(dmi->base_board.location, dmi_string(h, data[0x0A]),
sizeof(dmi->base_board.location));
- strncpy(dmi->base_board.type, dmi_string(h, data[0x0D]),
+ strlcpy(dmi->base_board.type, dmi_string(h, data[0x0D]),
sizeof(dmi->base_board.type));
if (h->length < 0x0F + data[0x0E] * sizeof(uint16_t))
break;
@@ -659,29 +659,29 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
if (h->length < 0x09)
break;
dmi->chassis.filled = true;
- strncpy(dmi->chassis.manufacturer, dmi_string(h, data[0x04]),
+ strlcpy(dmi->chassis.manufacturer, dmi_string(h, data[0x04]),
sizeof(dmi->chassis.manufacturer));
- strncpy(dmi->chassis.type, dmi_chassis_type(data[0x05] & 0x7F),
+ strlcpy(dmi->chassis.type, dmi_chassis_type(data[0x05] & 0x7F),
sizeof(dmi->chassis.type));
- strncpy(dmi->chassis.lock, dmi_chassis_lock(data[0x05] >> 7),
+ strlcpy(dmi->chassis.lock, dmi_chassis_lock(data[0x05] >> 7),
sizeof(dmi->chassis.lock));
- strncpy(dmi->chassis.version, dmi_string(h, data[0x06]),
+ strlcpy(dmi->chassis.version, dmi_string(h, data[0x06]),
sizeof(dmi->chassis.version));
- strncpy(dmi->chassis.serial, dmi_string(h, data[0x07]),
+ strlcpy(dmi->chassis.serial, dmi_string(h, data[0x07]),
sizeof(dmi->chassis.serial));
- strncpy(dmi->chassis.asset_tag, dmi_string(h, data[0x08]),
+ strlcpy(dmi->chassis.asset_tag, dmi_string(h, data[0x08]),
sizeof(dmi->chassis.asset_tag));
if (h->length < 0x0D)
break;
- strncpy(dmi->chassis.boot_up_state, dmi_chassis_state(data[0x09]),
+ strlcpy(dmi->chassis.boot_up_state, dmi_chassis_state(data[0x09]),
sizeof(dmi->chassis.boot_up_state));
- strncpy(dmi->chassis.power_supply_state,
+ strlcpy(dmi->chassis.power_supply_state,
dmi_chassis_state(data[0x0A]),
sizeof(dmi->chassis.power_supply_state));
- strncpy(dmi->chassis.thermal_state,
+ strlcpy(dmi->chassis.thermal_state,
dmi_chassis_state(data[0x0B]),
sizeof(dmi->chassis.thermal_state));
- strncpy(dmi->chassis.security_status,
+ strlcpy(dmi->chassis.security_status,
dmi_chassis_security_status(data[0x0C]),
sizeof(dmi->chassis.security_status));
if (h->length < 0x11)
@@ -698,31 +698,31 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
if (h->length < 0x1A)
break;
dmi->processor.filled = true;
- strncpy(dmi->processor.socket_designation,
+ strlcpy(dmi->processor.socket_designation,
dmi_string(h, data[0x04]),
sizeof(dmi->processor.socket_designation));
- strncpy(dmi->processor.type,
+ strlcpy(dmi->processor.type,
dmi_processor_type(data[0x05]), sizeof(dmi->processor.type));
- strncpy(dmi->processor.manufacturer,
+ strlcpy(dmi->processor.manufacturer,
dmi_string(h, data[0x07]), sizeof(dmi->processor.manufacturer));
- strncpy(dmi->processor.family,
+ strlcpy(dmi->processor.family,
dmi_processor_family(data[0x06],
dmi->processor.manufacturer),
sizeof(dmi->processor.family));
dmi_processor_id(data[0x06], data + 8, dmi_string(h, data[0x10]), dmi);
- strncpy(dmi->processor.version,
+ strlcpy(dmi->processor.version,
dmi_string(h, data[0x10]), sizeof(dmi->processor.version));
dmi_processor_voltage(data[0x11], dmi);
dmi->processor.external_clock = WORD(data + 0x12);
dmi->processor.max_speed = WORD(data + 0x14);
dmi->processor.current_speed = WORD(data + 0x16);
if (data[0x18] & (1 << 6))
- strncpy(dmi->processor.status,
+ strlcpy(dmi->processor.status,
dmi_processor_status(data[0x18] & 0x07),
sizeof(dmi->processor.status));
else
sprintf(dmi->processor.status, "Unpopulated");
- strncpy(dmi->processor.upgrade,
+ strlcpy(dmi->processor.upgrade,
dmi_processor_upgrade(data[0x19]),
sizeof(dmi->processor.upgrade));
if (h->length < 0x20)
@@ -735,11 +735,11 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
dmi->processor.cache3);
if (h->length < 0x23)
break;
- strncpy(dmi->processor.serial, dmi_string(h, data[0x20]),
+ strlcpy(dmi->processor.serial, dmi_string(h, data[0x20]),
sizeof(dmi->processor.serial));
- strncpy(dmi->processor.asset_tag, dmi_string(h, data[0x21]),
+ strlcpy(dmi->processor.asset_tag, dmi_string(h, data[0x21]),
sizeof(dmi->processor.asset_tag));
- strncpy(dmi->processor.part_number, dmi_string(h, data[0x22]),
+ strlcpy(dmi->processor.part_number, dmi_string(h, data[0x22]),
sizeof(dmi->processor.part_number));
break;
case 6: /* 3.3.7 Memory Module Information */
@@ -749,7 +749,7 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
s_memory_module *module =
&dmi->memory_module[dmi->memory_module_count - 1];
dmi->memory_module[dmi->memory_module_count - 1].filled = true;
- strncpy(module->socket_designation, dmi_string(h, data[0x04]),
+ strlcpy(module->socket_designation, dmi_string(h, data[0x04]),
sizeof(module->socket_designation));
dmi_memory_module_connections(data[0x05], module->bank_connections);
dmi_memory_module_speed(data[0x06], module->speed);
@@ -764,7 +764,7 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
dmi->cache_count++;
if (dmi->cache_count > MAX_DMI_CACHE_ITEMS)
break;
- strncpy(dmi->cache[dmi->cache_count - 1].socket_designation,
+ strlcpy(dmi->cache[dmi->cache_count - 1].socket_designation,
dmi_string(h, data[0x04]),
sizeof(dmi->cache[dmi->cache_count - 1].socket_designation));
snprintf(dmi->cache[dmi->cache_count - 1].configuration,
@@ -774,10 +774,10 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
WORD(data +
0x05) & 0x0008 ? "Socketed" : "Not Socketed",
(WORD(data + 0x05) & 0x0007) + 1);
- strncpy(dmi->cache[dmi->cache_count - 1].mode,
+ strlcpy(dmi->cache[dmi->cache_count - 1].mode,
dmi_cache_mode((WORD(data + 0x05) >> 8) & 0x0003),
sizeof(dmi->cache[dmi->cache_count - 1].mode));
- strncpy(dmi->cache[dmi->cache_count - 1].location,
+ strlcpy(dmi->cache[dmi->cache_count - 1].location,
dmi_cache_location((WORD(data + 0x05) >> 5) & 0x0003),
sizeof(dmi->cache[dmi->cache_count - 1].location));
dmi->cache[dmi->cache_count - 1].installed_size =
@@ -791,13 +791,13 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
if (h->length < 0x13)
break;
dmi->cache[dmi->cache_count - 1].speed = data[0x0F]; /* ns */
- strncpy(dmi->cache[dmi->cache_count - 1].error_correction_type,
+ strlcpy(dmi->cache[dmi->cache_count - 1].error_correction_type,
dmi_cache_ec_type(data[0x10]),
sizeof(dmi->cache[dmi->cache_count - 1].error_correction_type));
- strncpy(dmi->cache[dmi->cache_count - 1].system_type,
+ strlcpy(dmi->cache[dmi->cache_count - 1].system_type,
dmi_cache_type(data[0x11]),
sizeof(dmi->cache[dmi->cache_count - 1].system_type));
- strncpy(dmi->cache[dmi->cache_count - 1].associativity,
+ strlcpy(dmi->cache[dmi->cache_count - 1].associativity,
dmi_cache_associativity(data[0x12]),
sizeof(dmi->cache[dmi->cache_count - 1].associativity));
break;
@@ -826,15 +826,15 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
dmi_memory_device_width(WORD(data + 0x08), mem->total_width);
dmi_memory_device_width(WORD(data + 0x0A), mem->data_width);
dmi_memory_device_size(WORD(data + 0x0C), mem->size);
- strncpy(mem->form_factor,
+ strlcpy(mem->form_factor,
dmi_memory_device_form_factor(data[0x0E]),
sizeof(mem->form_factor));
dmi_memory_device_set(data[0x0F], mem->device_set);
- strncpy(mem->device_locator, dmi_string(h, data[0x10]),
+ strlcpy(mem->device_locator, dmi_string(h, data[0x10]),
sizeof(mem->device_locator));
- strncpy(mem->bank_locator, dmi_string(h, data[0x11]),
+ strlcpy(mem->bank_locator, dmi_string(h, data[0x11]),
sizeof(mem->bank_locator));
- strncpy(mem->type, dmi_memory_device_type(data[0x12]),
+ strlcpy(mem->type, dmi_memory_device_type(data[0x12]),
sizeof(mem->type));
dmi_memory_device_type_detail(WORD(data + 0x13), mem->type_detail);
if (h->length < 0x17)
@@ -842,33 +842,33 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
dmi_memory_device_speed(WORD(data + 0x15), mem->speed);
if (h->length < 0x1B)
break;
- strncpy(mem->manufacturer, dmi_string(h, data[0x17]),
+ strlcpy(mem->manufacturer, dmi_string(h, data[0x17]),
sizeof(mem->manufacturer));
- strncpy(mem->serial, dmi_string(h, data[0x18]), sizeof(mem->serial));
- strncpy(mem->asset_tag, dmi_string(h, data[0x19]),
+ strlcpy(mem->serial, dmi_string(h, data[0x18]), sizeof(mem->serial));
+ strlcpy(mem->asset_tag, dmi_string(h, data[0x19]),
sizeof(mem->asset_tag));
- strncpy(mem->part_number, dmi_string(h, data[0x1A]),
+ strlcpy(mem->part_number, dmi_string(h, data[0x1A]),
sizeof(mem->part_number));
break;
case 22: /* 3.3.23 Portable Battery */
if (h->length < 0x10)
break;
dmi->battery.filled = true;
- strncpy(dmi->battery.location, dmi_string(h, data[0x04]),
+ strlcpy(dmi->battery.location, dmi_string(h, data[0x04]),
sizeof(dmi->battery.location));
- strncpy(dmi->battery.manufacturer, dmi_string(h, data[0x05]),
+ strlcpy(dmi->battery.manufacturer, dmi_string(h, data[0x05]),
sizeof(dmi->battery.manufacturer));
if (data[0x06] || h->length < 0x1A)
- strncpy(dmi->battery.manufacture_date,
+ strlcpy(dmi->battery.manufacture_date,
dmi_string(h, data[0x06]),
sizeof(dmi->battery.manufacture_date));
if (data[0x07] || h->length < 0x1A)
- strncpy(dmi->battery.serial, dmi_string(h, data[0x07]),
+ strlcpy(dmi->battery.serial, dmi_string(h, data[0x07]),
sizeof(dmi->battery.serial));
- strncpy(dmi->battery.name, dmi_string(h, data[0x08]),
+ strlcpy(dmi->battery.name, dmi_string(h, data[0x08]),
sizeof(dmi->battery.name));
if (data[0x09] != 0x02 || h->length < 0x1A)
- strncpy(dmi->battery.chemistry,
+ strlcpy(dmi->battery.chemistry,
dmi_battery_chemistry(data[0x09]),
sizeof(dmi->battery.chemistry));
if (h->length < 0x1A)
@@ -878,7 +878,7 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
dmi_battery_capacity(WORD(data + 0x0A), data[0x15],
dmi->battery.design_capacity);
dmi_battery_voltage(WORD(data + 0x0C), dmi->battery.design_voltage);
- strncpy(dmi->battery.sbds, dmi_string(h, data[0x0E]),
+ strlcpy(dmi->battery.sbds, dmi_string(h, data[0x0E]),
sizeof(dmi->battery.sbds));
dmi_battery_maximum_error(data[0x0F], dmi->battery.maximum_error);
if (h->length < 0x1A)
@@ -890,7 +890,7 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
1980 + (WORD(data + 0x12) >> 9),
(WORD(data + 0x12) >> 5) & 0x0F, WORD(data + 0x12) & 0x1F);
if (data[0x09] == 0x02)
- strncpy(dmi->battery.sbds_chemistry, dmi_string(h, data[0x14]),
+ strlcpy(dmi->battery.sbds_chemistry, dmi_string(h, data[0x14]),
sizeof(dmi->battery.sbds_chemistry));
// sprintf(dmi->battery.oem_info,"0x%08X",DWORD(h, data+0x16));
break;
@@ -902,10 +902,10 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
dmi->system.system_reset.watchdog = data[0x04] & (1 << 5);
if (!(data[0x04] & (1 << 5)))
break;
- strncpy(dmi->system.system_reset.boot_option,
+ strlcpy(dmi->system.system_reset.boot_option,
dmi_system_reset_boot_option((data[0x04] >> 1) & 0x3),
sizeof dmi->system.system_reset.boot_option);
- strncpy(dmi->system.system_reset.boot_option_on_limit,
+ strlcpy(dmi->system.system_reset.boot_option_on_limit,
dmi_system_reset_boot_option((data[0x04] >> 3) & 0x3),
sizeof dmi->system.system_reset.boot_option_on_limit);
dmi_system_reset_count(WORD(data + 0x05),
@@ -921,16 +921,16 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
if (h->length < 0x05)
break;
dmi->hardware_security.filled = true;
- strncpy(dmi->hardware_security.power_on_passwd_status,
+ strlcpy(dmi->hardware_security.power_on_passwd_status,
dmi_hardware_security_status(data[0x04] >> 6),
sizeof dmi->hardware_security.power_on_passwd_status);
- strncpy(dmi->hardware_security.keyboard_passwd_status,
+ strlcpy(dmi->hardware_security.keyboard_passwd_status,
dmi_hardware_security_status((data[0x04] >> 4) & 0x3),
sizeof dmi->hardware_security.keyboard_passwd_status);
- strncpy(dmi->hardware_security.administrator_passwd_status,
+ strlcpy(dmi->hardware_security.administrator_passwd_status,
dmi_hardware_security_status((data[0x04] >> 2) & 0x3),
sizeof dmi->hardware_security.administrator_passwd_status);
- strncpy(dmi->hardware_security.front_panel_reset_status,
+ strlcpy(dmi->hardware_security.front_panel_reset_status,
dmi_hardware_security_status(data[0x04] & 0x3),
sizeof dmi->hardware_security.front_panel_reset_status);
break;
diff --git a/com32/gpllib/memory.c b/com32/gpllib/memory.c
index d98de030..28a95ff4 100644
--- a/com32/gpllib/memory.c
+++ b/com32/gpllib/memory.c
@@ -44,7 +44,7 @@ void get_type(int type, char *type_ptr, int type_ptr_sz)
{
unsigned int real_type = type - 1;
if (real_type < sizeof(e820_types) / sizeof(e820_types[0]))
- strncpy(type_ptr, e820_types[real_type], type_ptr_sz);
+ strlcpy(type_ptr, e820_types[real_type], type_ptr_sz);
}
/**
diff --git a/com32/gpllib/vpd/vpd.c b/com32/gpllib/vpd/vpd.c
index 6507f0d4..0e2b148e 100644
--- a/com32/gpllib/vpd/vpd.c
+++ b/com32/gpllib/vpd/vpd.c
@@ -81,19 +81,19 @@ int vpd_decode(s_vpd * vpd)
printf("VPD: Bad checksum!\n");
}
- strncpy(vpd->bios_build_id, q + 0x0D, 9);
- strncpy(vpd->box_serial_number, q + 0x16, 7);
- strncpy(vpd->motherboard_serial_number, q + 0x1D, 11);
- strncpy(vpd->machine_type_model, q + 0x28, 7);
+ strlcpy(vpd->bios_build_id, q + 0x0D, 9);
+ strlcpy(vpd->box_serial_number, q + 0x16, 7);
+ strlcpy(vpd->motherboard_serial_number, q + 0x1D, 11);
+ strlcpy(vpd->machine_type_model, q + 0x28, 7);
if (q[5] < 0x44)
return VPD_TABLE_PRESENT;
- strncpy(vpd->bios_release_date, q + 0x30, 8);
- strncpy(vpd->default_flash_filename, q + 0x38, 12);
+ strlcpy(vpd->bios_release_date, q + 0x30, 8);
+ strlcpy(vpd->default_flash_filename, q + 0x38, 12);
if (q[5] >= 0x46 && q[0x44] != 0x00) {
- strncpy(vpd->bios_version, q + 0x44, 255);
+ strlcpy(vpd->bios_version, q + 0x44, 255);
}
return VPD_TABLE_PRESENT;