1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtlogin: Two additional coverity fixes

This commit is contained in:
Peter Howkins 2018-04-24 03:57:35 +01:00
parent 3b2d34b5a4
commit ee4c38da0a
2 changed files with 8 additions and 6 deletions

View file

@ -243,10 +243,10 @@ Account( struct display *d, char *user, char *line, pid_t pid,
close(fd); close(fd);
} }
else else
strncpy(u->ut_line, line, sizeof(u->ut_line)); snprintf(u->ut_line, sizeof(u->ut_line), "%s", line);
#else #else
strncpy(u->ut_line, line, sizeof(u->ut_line)); snprintf(u->ut_line, sizeof(u->ut_line), "%s", line);
#endif #endif
} }
if (pid ) u->ut_pid = pid; if (pid ) u->ut_pid = pid;

View file

@ -940,9 +940,9 @@ char *temp_p;
* remove trailing spaces * remove trailing spaces
*/ */
if (strchr(startup_value.addr, ' ')) if (strchr(startup_value.addr, ' '))
strcpy(temp, strtok(startup_value.addr," ")); snprintf(temp, sizeof(temp), "%s", strtok(startup_value.addr, " "));
else else
strcpy(temp, startup_value.addr); snprintf(temp, sizeof(temp), "%s", startup_value.addr);
if (default_is_custom_dt) if (default_is_custom_dt)
if (strcmp(session, temp) == 0) { if (strcmp(session, temp) == 0) {
@ -1207,7 +1207,7 @@ MakeDialog( DialogType dtype )
FILE *fp, *fopen(); FILE *fp, *fopen();
char buffer[128]; char buffer[128];
Widget w, text; Widget w = NULL, text;
Dimension txt_width, txt_height; Dimension txt_width, txt_height;
XmString ok, cancel, nw, sv; XmString ok, cancel, nw, sv;
@ -1401,7 +1401,9 @@ MakeDialog( DialogType dtype )
XtSetArg(argt[0], XmNdialogStyle, XmDIALOG_APPLICATION_MODAL ); i++; XtSetArg(argt[0], XmNdialogStyle, XmDIALOG_APPLICATION_MODAL ); i++;
if(w) {
XtSetValues(w, argt, 1); XtSetValues(w, argt, 1);
}
XmStringFree(xmstr); XmStringFree(xmstr);
XmStringFree(ok); XmStringFree(ok);