When the current locale is ja_JP.eucjp or zh_CN, dtcm crashes on startup
as a subroutine
tries to dereference a null pointer. This trivial patch checks that
string!=NULL before dereferencing it.
After that correction, dtcm is working with the ja_JP locale. Some
problems remain:
* The year view of the calendar remains blank
* The month view shows '7n' instead of the Kanji for month
* The Kanjis of some days in the month view are replaced by alphanumeric
characters.
>From 18de9753e526d718a4895c32643be4058817647e Mon Sep 17 00:00:00 2001
From: Edmond Orignac <edmond.orig...@wanadoo.fr>
Date: Sat, 3 Apr 2021 22:25:23 +0200
Subject: [PATCH] misc.c: in cm_mbchar check string!=NULL before dereferencing
it
---
cde/config/cf/host.def | 1 +
cde/programs/dtcm/dtcm/misc.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/cde/config/cf/host.def b/cde/config/cf/host.def
index e69de29b..8b137891 100644
--- a/cde/config/cf/host.def
+++ b/cde/config/cf/host.def
@@ -0,0 +1 @@
+
diff --git a/cde/programs/dtcm/dtcm/misc.c b/cde/programs/dtcm/dtcm/misc.c
index 051547cb..d299f42b 100644
--- a/cde/programs/dtcm/dtcm/misc.c
+++ b/cde/programs/dtcm/dtcm/misc.c
@@ -639,7 +639,7 @@ cm_mbchar(char *str) {
free(buf);
buf = NULL;
}
- if ( *string == '\0' ) {
+ if ( string !=NULL && *string == '\0' ) {
free(string_head);
string_head = NULL;
string = NULL;
--
2.25.1
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel