From: Peter Howkins Date: Tue, 24 Apr 2018 02:57:35 +0000 (+0100) Subject: dtlogin: Two additional coverity fixes X-Git-Tag: 2.2.4a~63 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ee4c38da0ac91a0daf782706bf16faee1c409880;p=oweals%2Fcde.git dtlogin: Two additional coverity fixes --- diff --git a/cde/programs/dtlogin/account.c b/cde/programs/dtlogin/account.c index c9ff601a..cd33b637 100644 --- a/cde/programs/dtlogin/account.c +++ b/cde/programs/dtlogin/account.c @@ -243,10 +243,10 @@ Account( struct display *d, char *user, char *line, pid_t pid, close(fd); } else - strncpy(u->ut_line, line, sizeof(u->ut_line)); + snprintf(u->ut_line, sizeof(u->ut_line), "%s", line); #else - strncpy(u->ut_line, line, sizeof(u->ut_line)); + snprintf(u->ut_line, sizeof(u->ut_line), "%s", line); #endif } if (pid ) u->ut_pid = pid; diff --git a/cde/programs/dtlogin/vgmain.c b/cde/programs/dtlogin/vgmain.c index 1688110d..15cea36c 100644 --- a/cde/programs/dtlogin/vgmain.c +++ b/cde/programs/dtlogin/vgmain.c @@ -940,9 +940,9 @@ char *temp_p; * remove trailing spaces */ if (strchr(startup_value.addr, ' ')) - strcpy(temp, strtok(startup_value.addr," ")); + snprintf(temp, sizeof(temp), "%s", strtok(startup_value.addr, " ")); else - strcpy(temp, startup_value.addr); + snprintf(temp, sizeof(temp), "%s", startup_value.addr); if (default_is_custom_dt) if (strcmp(session, temp) == 0) { @@ -1207,7 +1207,7 @@ MakeDialog( DialogType dtype ) FILE *fp, *fopen(); char buffer[128]; - Widget w, text; + Widget w = NULL, text; Dimension txt_width, txt_height; XmString ok, cancel, nw, sv; @@ -1401,7 +1401,9 @@ MakeDialog( DialogType dtype ) XtSetArg(argt[0], XmNdialogStyle, XmDIALOG_APPLICATION_MODAL ); i++; - XtSetValues(w, argt, 1); + if(w) { + XtSetValues(w, argt, 1); + } XmStringFree(xmstr); XmStringFree(ok);