aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2010-07-12 14:56:43 +0800
committerFeng Tang <feng.tang@intel.com>2010-07-20 11:10:04 +0800
commit120975d73a0ae81382add713cb9df518e5a23d7a (patch)
tree7bb0745499cda1c532754f289cebd647a6b634e5
parent8a3653b8a47c87db6cf2178af7a5470895d4c45c (diff)
downloadsyslinux-120975d73a0ae81382add713cb9df518e5a23d7a.tar.gz
syslinux-120975d73a0ae81382add713cb9df518e5a23d7a.tar.xz
syslinux-120975d73a0ae81382add713cb9df518e5a23d7a.zip
elflink: merged gfxboot/gpllib/hdt/cmenu/ part
-rw-r--r--com32/cmenu/libmenu/com32io.c11
-rw-r--r--com32/cmenu/libmenu/com32io.h2
-rw-r--r--com32/gfxboot/gfxboot.c22
-rw-r--r--com32/gplinclude/dmi/dmi_memory.h8
-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.c48
-rw-r--r--com32/gpllib/dmi/dmi.c166
-rw-r--r--com32/gpllib/dmi/dmi_memory.c18
-rw-r--r--com32/gpllib/memory.c2
-rw-r--r--com32/gpllib/vpd/vpd.c14
-rw-r--r--com32/hdt/Makefile7
-rw-r--r--com32/hdt/floppy/hdt.cfg4
-rw-r--r--com32/hdt/hdt-cli-cpu.c2
-rw-r--r--com32/hdt/hdt-cli-hdt.c9
-rw-r--r--com32/hdt/hdt-cli-kernel.c2
-rw-r--r--com32/hdt/hdt-cli-pci.c4
-rw-r--r--com32/hdt/hdt-cli-pxe.c6
-rw-r--r--com32/hdt/hdt-cli.c24
-rw-r--r--com32/hdt/hdt-cli.h8
-rw-r--r--com32/hdt/hdt-common.c30
-rw-r--r--com32/hdt/hdt-common.h4
-rw-r--r--com32/hdt/hdt-menu.c7
-rw-r--r--com32/hdt/hdt.h4
25 files changed, 431 insertions, 447 deletions
diff --git a/com32/cmenu/libmenu/com32io.c b/com32/cmenu/libmenu/com32io.c
index 6a27d1a1..8e5016be 100644
--- a/com32/cmenu/libmenu/com32io.c
+++ b/com32/cmenu/libmenu/com32io.c
@@ -27,17 +27,6 @@ void getpos(char *row, char *col, char page)
*col = REG_DL(outreg);
}
-unsigned char sleep(unsigned int msec)
-{
- unsigned long micro = 1000 * msec;
-
- REG_AH(inreg) = 0x86;
- REG_CX(inreg) = (micro >> 16);
- REG_DX(inreg) = (micro & 0xFFFF);
- __intcall(0x15, &inreg, &outreg);
- return REG_AH(outreg);
-}
-
char inputc(char *scancode)
{
syslinux_idle(); /* So syslinux can perform periodic activity */
diff --git a/com32/cmenu/libmenu/com32io.h b/com32/cmenu/libmenu/com32io.h
index 6ff6857e..d9cce3d6 100644
--- a/com32/cmenu/libmenu/com32io.h
+++ b/com32/cmenu/libmenu/com32io.h
@@ -63,6 +63,4 @@ static inline char getvideomode(void) // Get the current video mode
return readbiosb(0x449);
}
-unsigned char sleep(unsigned int msec); // Sleep for specified time
-
#endif
diff --git a/com32/gfxboot/gfxboot.c b/com32/gfxboot/gfxboot.c
index a6c95fe1..dd4d6410 100644
--- a/com32/gfxboot/gfxboot.c
+++ b/com32/gfxboot/gfxboot.c
@@ -182,27 +182,29 @@ void boot_entry(menu_t *menu_ptr, char *arg);
int main(int argc, char **argv)
{
int menu_index;
- enum syslinux_filesystem syslinux_id;
- com32sys_t r;
+ const union syslinux_derivative_info *sdi;
openconsole(&dev_stdcon_r, &dev_stdcon_w);
- syslinux_id = syslinux_version()->filesystem;
-
lowmem_buf = __com32.cs_bounce;
lowmem_buf_size = __com32.cs_bounce_size;
- r.eax.l = 0x0a; // Get Derivative-Specific Information
- r.ecx.l = 9;
- __intcall(0x22, &r, &r);
- gfx_config.sector_shift = (uint8_t) r.ecx.l;
- gfx_config.boot_drive = (uint8_t) r.edx.l;
+ sdi = syslinux_derivative_info();
+
+ gfx_config.sector_shift = sdi->disk.sector_shift;
+ gfx_config.boot_drive = sdi->disk.drive_number;
- if(syslinux_id == SYSLINUX_FS_PXELINUX) {
+ if(sdi->c.filesystem == SYSLINUX_FS_PXELINUX) {
gfx_config.sector_shift = 11;
gfx_config.boot_drive = 0;
}
+ gfx_config.media_type = gfx_config.boot_drive < 0x80 ? 1 : 0;
+
+ if(sdi->c.filesystem == SYSLINUX_FS_ISOLINUX) {
+ gfx_config.media_type = sdi->iso.cd_mode ? 0 : 2;
+ }
+
gfx_config.bootloader = 1;
gfx_config.sysconfig_size = sizeof gfx_config;
gfx_config.bootloader_seg = 0; // apparently not needed
diff --git a/com32/gplinclude/dmi/dmi_memory.h b/com32/gplinclude/dmi/dmi_memory.h
index 47ad7fcd..4d0ad442 100644
--- a/com32/gplinclude/dmi/dmi_memory.h
+++ b/com32/gplinclude/dmi/dmi_memory.h
@@ -66,12 +66,12 @@ void dmi_memory_device_size(uint16_t code, char *size);
const char *dmi_memory_device_form_factor(uint8_t code);
void dmi_memory_device_set(uint8_t code, char *set);
const char *dmi_memory_device_type(uint8_t code);
-void dmi_memory_device_type_detail(uint16_t code, char *type_detail);
+void dmi_memory_device_type_detail(uint16_t code, char *type_detail, int sizeof_type_detail);
void dmi_memory_device_speed(uint16_t code, char *speed);
-void dmi_memory_module_connections(uint8_t, char *);
+void dmi_memory_module_connections(uint8_t, char *, int);
void dmi_memory_module_speed(uint8_t, char *);
-void dmi_memory_module_types(uint16_t, const char *, char *);
-void dmi_memory_module_size(uint8_t, char *);
+void dmi_memory_module_types(uint16_t, const char *, char *, int);
+void dmi_memory_module_size(uint8_t, char *, int);
void dmi_memory_module_error(uint8_t, const char *, char *);
#endif
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..41bb20c6 100644
--- a/com32/gpllib/disk/mbrs.c
+++ b/com32/gpllib/disk/mbrs.c
@@ -30,73 +30,75 @@ 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 if (((label >> 8) & 0xff) == 0x90)
+ strlcpy(buffer, "WEE", 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..507b11ac 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;
@@ -516,6 +516,8 @@ int dmi_iterate(s_dmi * dmi)
int found = 0;
/* Cleaning structures */
+ memset(dmi, 0, sizeof(s_dmi));
+
memset(&dmi->base_board, 0, sizeof(s_base_board));
memset(&dmi->battery, 0, sizeof(s_battery));
memset(&dmi->bios, 0, sizeof(s_bios));
@@ -579,16 +581,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 +613,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 +627,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 +637,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 +661,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 +700,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 +737,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,13 +751,13 @@ 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_connections(data[0x05], module->bank_connections, sizeof(module->bank_connections));
dmi_memory_module_speed(data[0x06], module->speed);
- dmi_memory_module_types(WORD(data + 0x07), " ", module->type);
- dmi_memory_module_size(data[0x09], module->installed_size);
- dmi_memory_module_size(data[0x0A], module->enabled_size);
+ dmi_memory_module_types(WORD(data + 0x07), " ", module->type, sizeof(module->type));
+ dmi_memory_module_size(data[0x09], module->installed_size, sizeof(module->installed_size));
+ dmi_memory_module_size(data[0x0A], module->enabled_size, sizeof(module->enabled_size));
dmi_memory_module_error(data[0x0B], "\t\t", module->error_status);
break;
case 7: /* 3.3.8 Cache Information */
@@ -764,7 +766,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 +776,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 +793,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,49 +828,49 @@ 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);
+ dmi_memory_device_type_detail(WORD(data + 0x13), mem->type_detail, sizeof(mem->type_detail));
if (h->length < 0x17)
break;
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 +880,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 +892,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 +904,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 +923,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/dmi/dmi_memory.c b/com32/gpllib/dmi/dmi_memory.c
index a1f2b440..21458293 100644
--- a/com32/gpllib/dmi/dmi_memory.c
+++ b/com32/gpllib/dmi/dmi_memory.c
@@ -132,7 +132,7 @@ const char *dmi_memory_device_type(uint8_t code)
return out_of_spec;
}
-void dmi_memory_device_type_detail(uint16_t code, char *type_detail)
+void dmi_memory_device_type_detail(uint16_t code, char *type_detail, int sizeof_type_detail)
{
/* 3.3.18.3 */
static const char *detail[] = {
@@ -157,7 +157,7 @@ void dmi_memory_device_type_detail(uint16_t code, char *type_detail)
for (i = 1; i <= 12; i++)
if (code & (1 << i))
- snprintf(type_detail,sizeof(type_detail), "%s", detail[i - 1]);
+ snprintf(type_detail, sizeof_type_detail, "%s", detail[i - 1]);
}
}
@@ -173,7 +173,7 @@ void dmi_memory_device_speed(uint16_t code, char *speed)
* 3.3.7 Memory Module Information (Type 6)
*/
-void dmi_memory_module_types(uint16_t code, const char *sep, char *type)
+void dmi_memory_module_types(uint16_t code, const char *sep, char *type, int sizeof_type)
{
/* 3.3.7.1 */
static const char *types[] = {
@@ -197,11 +197,11 @@ void dmi_memory_module_types(uint16_t code, const char *sep, char *type)
for (i = 0; i <= 10; i++)
if (code & (1 << i))
- snprintf(type,sizeof(type), "%s%s%s", type, sep, types[i]);
+ snprintf(type, sizeof_type, "%s%s%s", type, sep, types[i]);
}
}
-void dmi_memory_module_connections(uint8_t code, char *connection)
+void dmi_memory_module_connections(uint8_t code, char *connection, int sizeof_connection)
{
if (code == 0xFF)
sprintf(connection, "%s", "None");
@@ -209,7 +209,7 @@ void dmi_memory_module_connections(uint8_t code, char *connection)
if ((code & 0xF0) != 0xF0)
sprintf(connection, "%u ", code >> 4);
if ((code & 0x0F) != 0x0F)
- snprintf(connection,sizeof(connection), "%s%u", connection, code & 0x0F);
+ snprintf(connection, sizeof_connection, "%s%u", connection, code & 0x0F);
}
}
@@ -221,7 +221,7 @@ void dmi_memory_module_speed(uint8_t code, char *speed)
sprintf(speed, "%u ns", code);
}
-void dmi_memory_module_size(uint8_t code, char *size)
+void dmi_memory_module_size(uint8_t code, char *size, int sizeof_size)
{
/* 3.3.7.2 */
switch (code & 0x7F) {
@@ -239,9 +239,9 @@ void dmi_memory_module_size(uint8_t code, char *size)
}
if (code & 0x80)
- snprintf(size,sizeof(size),"%s %s", size, "(Double-bank Connection)");
+ snprintf(size, sizeof_size, "%s %s", size, "(Double-bank Connection)");
else
- snprintf(size,sizeof(size), "%s %s", size, "(Single-bank Connection)");
+ snprintf(size, sizeof_size, "%s %s", size, "(Single-bank Connection)");
}
void dmi_memory_module_error(uint8_t code, const char *prefix, char *error)
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;
diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile
index 5c02c43f..96af05f6 100644
--- a/com32/hdt/Makefile
+++ b/com32/hdt/Makefile
@@ -30,7 +30,7 @@ VERSION = $(shell $(SED) -n 's/\#define VERSION \"\(.*\)\"/\1/p' hdt.h)
CODENAME = $(shell $(SED) -n 's/\#define CODENAME \"\(.*\)\"/\1/p' hdt.h)
VERSION_C32 = $(shell echo $(VERSION) | $(SED) -e 's/-/_/g' | $(SED) -e 's/\./_/g')
-MEMTEST_URL = http://memtest.org/download/4.00/memtest86+-4.00.bin
+MEMTEST_URL = http://memtest.org/download/4.10/memtest86+-4.10.bin
MEMTEST = memtest.bin
KERNEL_VERSION ?= $(shell uname -r)
@@ -43,7 +43,6 @@ ISOLINUX_DIR ?= isolinux
FLOPPY_DIR ?= floppy
PCI_IDS_FILE ?= $(PWD)/$(FLOPPY_DIR)/pci.ids
GZ_PCI_IDS_FILE ?= $(PCI_IDS_FILE).gz
-REBOOT_COM32 ?= $(com32)/modules/reboot.c32
MENU_COM32 ?= $(com32)/menu/menu.c32
ART_DIR ?= art/
@@ -55,7 +54,7 @@ hdt.elf : $(OBJS) $(LIBS) $(C_LIBS)
memtest:
-[ ! -f $(FLOPPY_DIR)/$(MEMTEST) ] && $(WGET) $(MEMTEST_URL) -O $(FLOPPY_DIR)/$(MEMTEST)
-hdt.img: hdt.c32 $(FLOPPY_DIR)/hdt.cfg $(FLOPPY_DIR)/mtools.conf $(topdir)/mtools/syslinux $(REBOOT_COM32) $(MENU_COM32) memtest
+hdt.img: hdt.c32 $(FLOPPY_DIR)/hdt.cfg $(FLOPPY_DIR)/mtools.conf $(topdir)/mtools/syslinux $(MENU_COM32) memtest
rm -f hdt*.img
$(SED) -e 's/%VERSION%/$(VERSION)/g' $(FLOPPY_DIR)/hdt.cfg |\
$(SED) -e 's/%CODENAME%/$(CODENAME)/g' > $(FLOPPY_DIR)/syslinux.cfg
@@ -67,7 +66,6 @@ hdt.img: hdt.c32 $(FLOPPY_DIR)/hdt.cfg $(FLOPPY_DIR)/mtools.conf $(topdir)/mtool
-[ -f $(MODULES_PCIMAP_FILE) ] && cat $(MODULES_PCIMAP_FILE) | $(GZIPPROG) - -f | MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) - a:modules.pcimap
MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) hdt.c32 a:
MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(MENU_COM32) a:
- MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(REBOOT_COM32) a:
@ [ -f $(GZ_PCI_IDS_FILE) ] && MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(GZ_PCI_IDS_FILE) a:pci.ids || printf "\nThe $(GZ_PCI_IDS_FILE) file is missing and can be downloaded from http://pciids.sourceforge.net and gzipped in\nthe ./com32/hdt/$(FLOPPY_DIR) directory of the extracted Syslinux source.\n\n"
MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(FLOPPY_DIR)/syslinux.cfg a:
MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(FLOPPY_DIR)/$(MEMTEST) a:
@@ -88,7 +86,6 @@ hdt.iso: hdt.c32 $(topdir)/core/isolinux.bin $(FLOPPY_DIR)/hdt.cfg memtest
$(SED) -e 's/%VERSION%/$(VERSION)/g' $(FLOPPY_DIR)/hdt.cfg |\
$(SED) -e 's/%CODENAME%/$(CODENAME)/g' > $(ISO_DIR)/$(ISOLINUX_DIR)/isolinux.cfg
cp hdt.c32 $(ISO_DIR)/$(ISOLINUX_DIR)
- cp $(REBOOT_COM32) $(ISO_DIR)/$(ISOLINUX_DIR)
cp $(FLOPPY_DIR)/$(MEMTEST) $(ISO_DIR)/$(ISOLINUX_DIR)
cp $(MENU_COM32) $(ISO_DIR)/$(ISOLINUX_DIR)
cp -av $(ART_DIR)/backgnd.png $(ISO_DIR)/$(ISOLINUX_DIR)
diff --git a/com32/hdt/floppy/hdt.cfg b/com32/hdt/floppy/hdt.cfg
index 27d11bac..1350521a 100644
--- a/com32/hdt/floppy/hdt.cfg
+++ b/com32/hdt/floppy/hdt.cfg
@@ -71,8 +71,8 @@ APPEND modules_pcimap=modules.pcimap modules_alias=modules.alias pciids=pci.ids
MENU SEPARATOR
LABEL memtest
-MENU LABEL Memtest86+ 4.00
+MENU LABEL Memtest86+ 4.10
TEXT HELP
- Starts Memtest86+ 4.00
+ Starts Memtest86+ 4.10
ENDTEXT
LINUX memtest.bin
diff --git a/com32/hdt/hdt-cli-cpu.c b/com32/hdt/hdt-cli-cpu.c
index aa7ec8f7..1695ccd7 100644
--- a/com32/hdt/hdt-cli-cpu.c
+++ b/com32/hdt/hdt-cli-cpu.c
@@ -67,7 +67,7 @@ static void show_flag(char *buffer, bool flag, char *flag_name, bool flush)
if ((((strlen(buffer) + strlen(flag_name)) > 66) && flag) || flush) {
snprintf(output_buffer, sizeof output_buffer, "Flags : %s\n",
buffer);
- more_printf(output_buffer);
+ more_printf("%s", output_buffer);
memset(buffer, 0, sizeof(buffer));
if (flush)
return;
diff --git a/com32/hdt/hdt-cli-hdt.c b/com32/hdt/hdt-cli-hdt.c
index 65bb4444..f4854e37 100644
--- a/com32/hdt/hdt-cli-hdt.c
+++ b/com32/hdt/hdt-cli-hdt.c
@@ -30,6 +30,7 @@
#include <string.h>
#include <stdlib.h>
#include <syslinux/config.h>
+#include <syslinux/reboot.h>
#include "hdt-menu.h"
#include "hdt-cli.h"
@@ -246,11 +247,9 @@ void main_show_hdt(int argc __unused, char **argv __unused,
static void do_reboot(int argc __unused, char **argv __unused,
struct s_hardware *hardware)
{
- /* Use specific syslinux call if needed */
- if (issyslinux())
- return runsyslinuxcmd(hardware->reboot_label);
- else
- return csprint(hardware->reboot_label, 0x07);
+ (void) hardware;
+ /* Let's call the internal rebooting call */
+ syslinux_reboot(1);
}
/* Default hdt mode */
diff --git a/com32/hdt/hdt-cli-kernel.c b/com32/hdt/hdt-cli-kernel.c
index d4946f30..f64771b7 100644
--- a/com32/hdt/hdt-cli-kernel.c
+++ b/com32/hdt/hdt-cli-kernel.c
@@ -83,7 +83,7 @@ void main_show_kernel(int argc __unused, char **argv __unused,
}
if (found == true) {
strncat(buffer, "\n", 1);
- more_printf(buffer);
+ more_printf("%s", buffer);
}
}
diff --git a/com32/hdt/hdt-cli-pci.c b/com32/hdt/hdt-cli-pci.c
index c86a7928..e0b78309 100644
--- a/com32/hdt/hdt-cli-pci.c
+++ b/com32/hdt/hdt-cli-pci.c
@@ -206,8 +206,8 @@ static void show_pci_devices(int argc __unused, char **argv __unused,
pci_device->product,
pci_device->sub_vendor, pci_device->sub_product);
- more_printf(first_line);
- more_printf(second_line);
+ more_printf("%s", first_line);
+ more_printf("%s", second_line);
more_printf("\n");
} else if (nopciids == true) {
if (nomodulesfile == true) {
diff --git a/com32/hdt/hdt-cli-pxe.c b/com32/hdt/hdt-cli-pxe.c
index 3a61bc02..29e760aa 100644
--- a/com32/hdt/hdt-cli-pxe.c
+++ b/com32/hdt/hdt-cli-pxe.c
@@ -66,14 +66,14 @@ void main_show_pxe(int argc __unused, char **argv __unused,
snprintf(buffer, sizeof(buffer),
" PCI Bus pos. : %02x:%02x.%02x\n", p->pci_bus,
p->pci_dev, p->pci_func);
- more_printf(buffer);
+ more_printf("%s", buffer);
} else {
snprintf(buffer, sizeof(buffer), " Manufacturer : %s \n",
p->pci_device->dev_info->vendor_name);
- more_printf(buffer);
+ more_printf("%s", buffer);
snprintf(buffer, sizeof(buffer), " Product : %s \n",
p->pci_device->dev_info->product_name);
- more_printf(buffer);
+ more_printf("%s", buffer);
}
more_printf(" Addresses : %d.%d.%d.%d @ %s\n", p->ip_addr[0],
p->ip_addr[1], p->ip_addr[2], p->ip_addr[3], p->mac_addr);
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index dad2d408..639bcdb8 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -85,7 +85,7 @@ static void autocomplete_add_token_to_list(const char *token)
{
struct autocomplete_list *new = malloc(sizeof(struct autocomplete_list));
- strncpy(new->autocomplete_token, token, sizeof(new->autocomplete_token));
+ strlcpy(new->autocomplete_token, token, sizeof(new->autocomplete_token));
new->next = NULL;
autocomplete_backlog++;
@@ -277,13 +277,13 @@ static void expand_aliases(char *line __unused, char **command, char **module,
*argc = 1;
*argv = malloc(*argc * sizeof(char *));
argv[0] = malloc((sizeof(*command) + 1) * sizeof(char));
- strncpy(argv[0], *command, sizeof(*command) + 1);
+ strlcpy(argv[0], *command, sizeof(*command) + 1);
dprintf("CLI DEBUG: ALIAS %s ", *command);
- strncpy(*command, CLI_SET, sizeof(CLI_SET)); /* set */
+ strlcpy(*command, CLI_SET, sizeof(CLI_SET)); /* set */
*module = malloc(sizeof(CLI_MODE) * sizeof(char));
- strncpy(*module, CLI_MODE, sizeof(CLI_MODE)); /* mode */
+ strlcpy(*module, CLI_MODE, sizeof(CLI_MODE)); /* mode */
dprintf("--> %s %s %s\n", *command, *module, argv[0]);
goto out;
@@ -295,7 +295,7 @@ static void expand_aliases(char *line __unused, char **command, char **module,
if (!strncmp(*command, hdt_aliases[i].aliases[j],
sizeof(hdt_aliases[i].aliases[j]))) {
dprintf("CLI DEBUG: ALIAS %s ", *command);
- strncpy(*command, hdt_aliases[i].command,
+ strlcpy(*command, hdt_aliases[i].command,
sizeof(hdt_aliases[i].command) + 1);
dprintf("--> %s\n", *command);
goto out; /* Don't allow chaining aliases */
@@ -367,14 +367,14 @@ static void parse_command_line(char *line, char **command, char **module,
if (token_found == 0) {
/* Main command to execute */
*command = malloc((token_len + 1) * sizeof(char));
- strncpy(*command, pch, token_len);
+ strlcpy(*command, pch, token_len);
(*command)[token_len] = '\0';
dprintf("CLI DEBUG: command = %s\n", *command);
args_pos += args_len;
} else if (token_found == 1) {
/* Module */
*module = malloc((token_len + 1) * sizeof(char));
- strncpy(*module, pch, token_len);
+ strlcpy(*module, pch, token_len);
(*module)[token_len] = '\0';
dprintf("CLI DEBUG: module = %s\n", *module);
args_pos += args_len;
@@ -396,7 +396,7 @@ static void parse_command_line(char *line, char **command, char **module,
while (pch != NULL) {
dprintf("CLI DEBUG: argv[%d] = %s\n", argc_iter, pch);
argv[argc_iter] = malloc(sizeof(pch) * sizeof(char));
- strncpy(argv[argc_iter], pch, sizeof(pch));
+ strlcpy(argv[argc_iter], pch, sizeof(pch));
argc_iter++;
pch = strtok(NULL, CLI_SPACE);
/*
@@ -918,7 +918,7 @@ void start_cli_mode(struct s_hardware *hardware)
/* Let's make that future position the one we use */
memset(INPUT, 0, sizeof(INPUT));
- strncpy(INPUT, hdt_cli.history[future_history_pos], sizeof(INPUT));
+ strlcpy(INPUT, hdt_cli.history[future_history_pos], sizeof(INPUT));
/* Clear the line */
clear_line();
@@ -959,7 +959,7 @@ void start_cli_mode(struct s_hardware *hardware)
/* Let's make that future position the one we use */
memset(INPUT, 0, sizeof(INPUT));
- strncpy(INPUT, hdt_cli.history[future_history_pos], sizeof(INPUT));
+ strlcpy(INPUT, hdt_cli.history[future_history_pos], sizeof(INPUT));
/* Clear the line */
clear_line();
@@ -979,7 +979,7 @@ void start_cli_mode(struct s_hardware *hardware)
move_cursor_to_column(0);
reset_prompt();
printf("%s", autocomplete_last_seen->autocomplete_token);
- strncpy(INPUT,
+ strlcpy(INPUT,
autocomplete_last_seen->autocomplete_token,
sizeof(INPUT));
hdt_cli.cursor_pos = strlen(INPUT);
@@ -1093,7 +1093,7 @@ void start_cli_mode(struct s_hardware *hardware)
char key[2];
int trailing_chars = strlen(INPUT) - hdt_cli.cursor_pos;
memset(temp_command, 0, sizeof(temp_command));
- strncpy(temp_command, INPUT, hdt_cli.cursor_pos);
+ strlcpy(temp_command, INPUT, hdt_cli.cursor_pos);
sprintf(key, "%c", current_key);
strncat(temp_command, key, 1);
strncat(temp_command,
diff --git a/com32/hdt/hdt-cli.h b/com32/hdt/hdt-cli.h
index d9632b2d..98246b4d 100644
--- a/com32/hdt/hdt-cli.h
+++ b/com32/hdt/hdt-cli.h
@@ -30,16 +30,10 @@
#define DEFINE_HDT_CLI_H
#include <stdio.h>
#include <getkey.h>
+#include <dprintf.h>
#include "hdt-common.h"
-#define DEBUG 0
-#if DEBUG
-# define dprintf printf
-#else
-# define dprintf(f, ...) ((void)0)
-#endif
-
#define MAX_LINE_SIZE 256
#define CLI_SPACE " "
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index 736d9b6e..5a187f26 100644
--- a/com32/hdt/hdt-common.c
+++ b/com32/hdt/hdt-common.c
@@ -70,31 +70,27 @@ void detect_parameters(const int argc, const char *argv[],
if (!strncmp(argv[i], "quiet", 5)) {
quiet = true;
} else if (!strncmp(argv[i], "modules_pcimap=", 15)) {
- strncpy(hardware->modules_pcimap_path, argv[i] + 15,
+ strlcpy(hardware->modules_pcimap_path, argv[i] + 15,
sizeof(hardware->modules_pcimap_path));
convert_isolinux_filename(hardware->modules_pcimap_path, hardware);
} else if (!strncmp(argv[i], "pciids=", 7)) {
- strncpy(hardware->pciids_path, argv[i] + 7,
+ strlcpy(hardware->pciids_path, argv[i] + 7,
sizeof(hardware->pciids_path));
convert_isolinux_filename(hardware->pciids_path, hardware);
} else if (!strncmp(argv[i], "modules_alias=", 14)) {
- strncpy(hardware->modules_alias_path, argv[i] + 14,
+ strlcpy(hardware->modules_alias_path, argv[i] + 14,
sizeof(hardware->modules_alias_path));
convert_isolinux_filename(hardware->modules_alias_path, hardware);
} else if (!strncmp(argv[i], "memtest=", 8)) {
- strncpy(hardware->memtest_label, argv[i] + 8,
+ strlcpy(hardware->memtest_label, argv[i] + 8,
sizeof(hardware->memtest_label));
convert_isolinux_filename(hardware->memtest_label, hardware);
- } else if (!strncmp(argv[i], "reboot=", 7)) {
- strncpy(hardware->reboot_label, argv[i] + 7,
- sizeof(hardware->reboot_label));
- convert_isolinux_filename(hardware->reboot_label, hardware);
} else if (!strncmp(argv[i], "vesa", 4)) {
vesamode = true;
max_console_lines = MAX_CLI_LINES;
/* If the user defines a background image */
if (!strncmp(argv[i], "vesa=", 5)) {
- strncpy(hardware->vesa_background, argv[i] + 5,
+ strlcpy(hardware->vesa_background, argv[i] + 5,
sizeof(hardware->vesa_background));
}
} else if (!strncmp(argv[i], "novesa", 6)) {
@@ -191,15 +187,13 @@ void init_hardware(struct s_hardware *hardware)
memset(hardware->modules_alias_path, 0,
sizeof hardware->modules_alias_path);
memset(hardware->memtest_label, 0, sizeof hardware->memtest_label);
- memset(hardware->reboot_label, 0, sizeof hardware->reboot_label);
memset(hardware->auto_label, 0, sizeof hardware->auto_label);
memset(hardware->vesa_background, 0, sizeof hardware->vesa_background);
strcat(hardware->pciids_path, "pci.ids");
strcat(hardware->modules_pcimap_path, "modules.pcimap");
strcat(hardware->modules_alias_path, "modules.alias");
strcat(hardware->memtest_label, "memtest");
- strcat(hardware->reboot_label, "reboot.c32");
- strncpy(hardware->vesa_background, CLI_DEFAULT_BACKGROUND,
+ strlcpy(hardware->vesa_background, CLI_DEFAULT_BACKGROUND,
sizeof(hardware->vesa_background));
}
@@ -277,11 +271,11 @@ int detect_vesa(struct s_hardware *hardware)
mode_ptr = GET_PTR(gi->video_mode_ptr);
oem_ptr = GET_PTR(gi->oem_vendor_name_ptr);
- strncpy(hardware->vesa.vendor, oem_ptr, sizeof(hardware->vesa.vendor));
+ strlcpy(hardware->vesa.vendor, oem_ptr, sizeof(hardware->vesa.vendor));
oem_ptr = GET_PTR(gi->oem_product_name_ptr);
- strncpy(hardware->vesa.product, oem_ptr, sizeof(hardware->vesa.product));
+ strlcpy(hardware->vesa.product, oem_ptr, sizeof(hardware->vesa.product));
oem_ptr = GET_PTR(gi->oem_product_rev_ptr);
- strncpy(hardware->vesa.product_revision, oem_ptr,
+ strlcpy(hardware->vesa.product_revision, oem_ptr,
sizeof(hardware->vesa.product_revision));
hardware->vesa.major_version = (gi->version >> 8) & 0xff;
@@ -533,13 +527,13 @@ void cpu_detect(struct s_hardware *hardware)
/* Old processors doesn't manage the identify commands
* Let's use the dmi value in that case */
if (strlen(remove_spaces(hardware->cpu.model)) == 0)
- strncpy(hardware->cpu.model, hardware->dmi.processor.version,
+ strlcpy(hardware->cpu.model, hardware->dmi.processor.version,
sizeof(hardware->cpu.model));
/* Some CPUs like to put many spaces in the model name
* That makes some weird display in console/menu
* Let's remove that mulitple spaces */
- strncpy(hardware->cpu.model,del_multi_spaces(hardware->cpu.model),sizeof(hardware->cpu.model));
+ strlcpy(hardware->cpu.model,del_multi_spaces(hardware->cpu.model),sizeof(hardware->cpu.model));
hardware->cpu_detection = true;
}
@@ -631,7 +625,7 @@ char *del_multi_spaces(char *p)
/* Let's copy to the current position
* the content from the second space*/
- strncpy(p, p + 1, strlen(p + 1));
+ strlcpy(p, p + 1, strlen(p + 1));
/* The string is 1 char smaller */
*(p + strlen(p) - 1) = '\0';
diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h
index 0a0c8c4e..fd9d7853 100644
--- a/com32/hdt/hdt-common.h
+++ b/com32/hdt/hdt-common.h
@@ -60,6 +60,9 @@
#define HDT_RETURN_TO_CLI 100
#define MAX_VESA_MODES 255
+/* This value is used for rebooting from the menu mode */
+#define HDT_REBOOT "hdt_reboot"
+
/* The maximum number of commands we can process */
#define MAX_NB_AUTO_COMMANDS 255
/* The maximum size of a command */
@@ -196,7 +199,6 @@ struct s_hardware {
char modules_alias_path[255];
char pciids_path[255];
char memtest_label[255];
- char reboot_label[255];
char auto_label[AUTO_COMMAND_SIZE];
char vesa_background[255];
};
diff --git a/com32/hdt/hdt-menu.c b/com32/hdt/hdt-menu.c
index 4629ee58..219f6987 100644
--- a/com32/hdt/hdt-menu.c
+++ b/com32/hdt/hdt-menu.c
@@ -28,6 +28,7 @@
#include <unistd.h>
#include <memory.h>
+#include <syslinux/reboot.h>
#include "hdt-menu.h"
int start_menu_mode(struct s_hardware *hardware, char *version_string)
@@ -64,6 +65,10 @@ int start_menu_mode(struct s_hardware *hardware, char *version_string)
(curr->data, HDT_SWITCH_TO_CLI, sizeof(HDT_SWITCH_TO_CLI))) {
return HDT_RETURN_TO_CLI;
}
+ if (!strncmp
+ (curr->data, HDT_REBOOT, sizeof(HDT_REBOOT))) {
+ syslinux_reboot(1);
+ }
strcpy(cmd, curr->data);
/* Use specific syslinux call if needed */
@@ -284,7 +289,7 @@ void compute_main_menu(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
HDT_SWITCH_TO_CLI, 0);
add_item("<A>bout", "About Menu", OPT_SUBMENU, NULL,
hdt_menu->about_menu.menu);
- add_item("<R>eboot", "Reboot", OPT_RUN, hardware->reboot_label, 0);
+ add_item("<R>eboot", "Reboot", OPT_RUN, HDT_REBOOT, 0);
add_item("E<x>it", "Exit", OPT_EXITMENU, NULL, 0);
hdt_menu->main_menu.items_count++;
diff --git a/com32/hdt/hdt.h b/com32/hdt/hdt.h
index db6b9ef2..0c7535d1 100644
--- a/com32/hdt/hdt.h
+++ b/com32/hdt/hdt.h
@@ -33,8 +33,8 @@
#define AUTHOR "Erwan Velu"
#define CORE_DEVELOPER "Pierre-Alexandre Meyer"
#define CONTACT "hdt@zytor.com"
-#define VERSION "0.3.6"
-#define CODENAME "bluelabel"
+#define VERSION "0.3.6.1"
+#define CODENAME "cachaca"
#define NB_CONTRIBUTORS 3
#define CONTRIBUTORS {"Sebastien Gonzalve (Patches)", "Gert Hulselmans (Tests)", "Alexander Andino (Design)"}
#define WEBSITE_URL "http://hdt-project.org"