changeset 2083:f1acc157b2dd

Win: Correctly show "IE" as HTML renderer if built with Edge support... but a supported version of Edge cannot be detected. Also bump the size of the fields in the DWEnv struct to be 65 characters in line with the size of Linux utsname fields so gcc fortify won't complain about possible truncation during strncpy().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 31 May 2020 15:15:34 +0000
parents 3144912829e2
children 524cb235a555
files dw.h win/dw.c
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dw.h	Sun May 31 05:26:02 2020 +0000
+++ b/dw.h	Sun May 31 15:15:34 2020 +0000
@@ -1331,15 +1331,18 @@
 typedef unsigned long DWTID;
 #endif
 
+/* Use at least the linux utsname limit to avoid gcc fortify warnings */
+#define _DW_ENV_STRING_SIZE 65
+
 typedef struct _dwenv {
    /* Operating System Name and DW Build Date/Time */
-   char osName[30], buildDate[30], buildTime[30];
+   char osName[_DW_ENV_STRING_SIZE], buildDate[_DW_ENV_STRING_SIZE], buildTime[_DW_ENV_STRING_SIZE];
    /* Versions and builds */
    short MajorVersion, MinorVersion, MajorBuild, MinorBuild;
    /* Dynamic Window version */
    short DWMajorVersion, DWMinorVersion, DWSubVersion;
    /* Which HTML engine is compiled in */
-   char htmlEngine[30];
+   char htmlEngine[_DW_ENV_STRING_SIZE];
 } DWEnv;
 
 
--- a/win/dw.c	Sun May 31 05:26:02 2020 +0000
+++ b/win/dw.c	Sun May 31 15:15:34 2020 +0000
@@ -12423,7 +12423,7 @@
    strcpy(env->buildTime, __TIME__);
 #if (defined(BUILD_DLL) || defined(BUILD_HTML))
 #  ifdef BUILD_EDGE
-   strcpy(env->htmlEngine, "EDGE");
+   strcpy(env->htmlEngine, _DW_EDGE_DETECTED ? "EDGE" : "IE");
 #  else
    strcpy(env->htmlEngine, "IE");
 #  endif