From f17e234dd057b8a8426af79fff4f47392c8a30ed Mon Sep 17 00:00:00 2001
From: Robert Sprowson <rsprowson@gitlab.riscosopen.org>
Date: Sun, 19 Apr 2020 20:53:53 +0100
Subject: [PATCH] Fix for NULL pointer write

The spec of os_byte() requires 2 valid pointers, since the return values are unconditionally written to them. Use a dummy pointer for the unwanted result, not 0.
Fixes application crash https://www.riscosopen.org/forum/forums/1/topics/15189#posts-101073.

Version 6.04. Tagged as 'RISC_OSLib-6_04'
---
 VersionASM      | 12 ++++++------
 VersionNum      | 22 +++++++++++-----------
 rlib/c/drawfobj |  4 ++--
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/VersionASM b/VersionASM
index 67fe72b..cf13d1f 100644
--- a/VersionASM
+++ b/VersionASM
@@ -9,12 +9,12 @@
                         GBLS    Module_ApplicationDate
                         GBLS    Module_HelpVersion
                         GBLS    Module_ComponentName
-Module_MajorVersion     SETS    "6.03"
-Module_Version          SETA    603
+Module_MajorVersion     SETS    "6.04"
+Module_Version          SETA    604
 Module_MinorVersion     SETS    ""
-Module_Date             SETS    "27 Jul 2019"
-Module_ApplicationDate  SETS    "27-Jul-19"
+Module_Date             SETS    "22 Apr 2020"
+Module_ApplicationDate  SETS    "22-Apr-20"
 Module_ComponentName    SETS    "RISC_OSLib"
-Module_FullVersion      SETS    "6.03"
-Module_HelpVersion      SETS    "6.03 (27 Jul 2019)"
+Module_FullVersion      SETS    "6.04"
+Module_HelpVersion      SETS    "6.04 (22 Apr 2020)"
                         END
diff --git a/VersionNum b/VersionNum
index dead4cd..2fb91f0 100644
--- a/VersionNum
+++ b/VersionNum
@@ -1,21 +1,21 @@
-/* (6.03)
+/* (6.04)
  *
  * This file is automatically maintained by srccommit, do not edit manually.
  *
  */
-#define Module_MajorVersion_CMHG        6.03
-#define Module_MinorVersion_CMHG        
-#define Module_Date_CMHG                27 Jul 2019
+#define Module_MajorVersion_CMHG        6.04
+#define Module_MinorVersion_CMHG
+#define Module_Date_CMHG                22 Apr 2020
 
-#define Module_MajorVersion             "6.03"
-#define Module_Version                  603
+#define Module_MajorVersion             "6.04"
+#define Module_Version                  604
 #define Module_MinorVersion             ""
-#define Module_Date                     "27 Jul 2019"
+#define Module_Date                     "22 Apr 2020"
 
-#define Module_ApplicationDate          "27-Jul-19"
+#define Module_ApplicationDate          "22-Apr-20"
 
 #define Module_ComponentName            "RISC_OSLib"
 
-#define Module_FullVersion              "6.03"
-#define Module_HelpVersion              "6.03 (27 Jul 2019)"
-#define Module_LibraryVersionInfo       "6:3"
+#define Module_FullVersion              "6.04"
+#define Module_HelpVersion              "6.04 (22 Apr 2020)"
+#define Module_LibraryVersionInfo       "6:4"
diff --git a/rlib/c/drawfobj b/rlib/c/drawfobj
index 615f660..94b1c99 100644
--- a/rlib/c/drawfobj
+++ b/rlib/c/drawfobj
@@ -154,7 +154,7 @@ static void dr_setBox(draw_redrawstr *r, double scalefactor,
 
 static int dr_setScreenState(void)
 {
-  int VDUstatus;           /* VDU status: only the VDU5 setting matters */
+  int VDUstatus, dummy;    /* VDU status: only the VDU5 setting matters */
   int dx = wimpt_dx(), dy = wimpt_dy();
   int xeig = 0, yeig = 0;
 
@@ -178,7 +178,7 @@ static int dr_setScreenState(void)
   }
 
   /* Get VDU status */
-  os_byte(117, &VDUstatus, 0);
+  os_byte(117, &VDUstatus, &dummy);
 
   /* Set to VDU5 mode */
   bbc_vdu(5);
-- 
GitLab