From a97ab71059b7111b0e8df15afb658b1c83a4cf99 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Sat, 26 Jan 2019 00:03:34 +0000 Subject: [PATCH 1/3] Avoid a NULL pointer dereference "dtcm: Coverity 89051" fixed an instance of this on the previous line, but not this one. --- cde/programs/dtcm/dtcm/group_editor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cde/programs/dtcm/dtcm/group_editor.c b/cde/programs/dtcm/dtcm/group_editor.c index cb51f948f..9c528e360 100644 --- a/cde/programs/dtcm/dtcm/group_editor.c +++ b/cde/programs/dtcm/dtcm/group_editor.c @@ -1685,13 +1685,14 @@ add_to_gaccess_list( char access, *buf; XmString xmstr; Calendar *c; - Props_pu *p = (Props_pu *)ge->cal->properties_pu; + Props_pu *p; Access_data *new_data = NULL; if (!ge) return; c = ge->cal; + p = (Props_pu *)c->properties_pu; while (ge->access_data && cnt <= ge->access_data->count) { new_data = (Access_data *) From 162c88b6ea5a503c6c3f9df6b15d094ca4527296 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Sat, 26 Jan 2019 00:05:23 +0000 Subject: [PATCH 2/3] Don't dereference an uninitialised pointer This was an incorrect fix in "dtcm: Coverity 88382". --- cde/programs/dtcm/dtcm/rfp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cde/programs/dtcm/dtcm/rfp.c b/cde/programs/dtcm/dtcm/rfp.c index 458768623..0615b38fc 100644 --- a/cde/programs/dtcm/dtcm/rfp.c +++ b/cde/programs/dtcm/dtcm/rfp.c @@ -214,7 +214,7 @@ rfp_apply_proc(Widget w, XtPointer client_data, XtPointer cbs) { char *str, buf[128]; XmString xmstr; Calendar *c; - Props_pu *pu = (Props_pu *)c->properties_pu; + Props_pu *pu; Repeat_scope_menu_op op = REPEAT_DAYS; char *repeat_str; @@ -222,6 +222,7 @@ rfp_apply_proc(Widget w, XtPointer client_data, XtPointer cbs) { return; c = rfp->cal; + pu = (Props_pu *)c->properties_pu; str = XmTextGetString(rfp->repeat_popup_text); From ae499c794ebbd4402be3dc3e471d71d1502d5770 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Sat, 26 Jan 2019 00:07:36 +0000 Subject: [PATCH 3/3] Explicitly initialise two more static pointers "dtcm: Coverity 88006" fixed this for buf, but not for string in the same function (and we may as well initialise string_head for consistency too). --- cde/programs/dtcm/dtcm/misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cde/programs/dtcm/dtcm/misc.c b/cde/programs/dtcm/dtcm/misc.c index 118ad3d12..1b8b18a8e 100644 --- a/cde/programs/dtcm/dtcm/misc.c +++ b/cde/programs/dtcm/dtcm/misc.c @@ -621,8 +621,8 @@ cm_mbstrlen(char *s) { */ extern char * cm_mbchar(char *str) { - static char *string; - static char *string_head; + static char *string = NULL; + static char *string_head = NULL; static char *buf = NULL; int num_byte = 0;