screen-5.0.0-1.fc42

List of Findings

Error: CPPCHECK_WARNING (CWE-476): [#def1]
screen-5.0.0-build/screen-5.0.0/acls.c:553: warning[nullPointer]: Possible null pointer dereference: win
#  551|   		bitarray = uu->u_umask_w_bits;
#  552|   	} else {
#  553|-> 		bitarray = win->w_userbits;
#  554|   	}
#  555|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
screen-5.0.0-build/screen-5.0.0/ansi.c: scope_hint: In function ‘MFixLine’
screen-5.0.0-build/screen-5.0.0/ansi.c:1928:20: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc((long unsigned int)(*win.w_layer.l_width + 1), 4)’
screen-5.0.0-build/screen-5.0.0/screen.h:72: included_from: Included from here.
screen-5.0.0-build/screen-5.0.0/ansi.c:37: included_from: Included from here.
screen-5.0.0-build/screen-5.0.0/ansi.c:1919:45: note: in expansion of macro ‘w_width’
screen-5.0.0-build/screen-5.0.0/ansi.c:1928:48: note: in expansion of macro ‘w_width’
# 1926|   	}
# 1927|   	if (mc->colorbg && ml->colorbg == null) {
# 1928|-> 		if ((ml->colorbg = calloc(win->w_width + 1, 4)) == NULL) {
# 1929|   			ml->colorbg = null;
# 1930|   			mc->colorbg = win->w_rend.colorbg = 0;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
screen-5.0.0-build/screen-5.0.0/ansi.c:1935:20: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc((long unsigned int)(*win.w_layer.l_width + 1), 4)’
screen-5.0.0-build/screen-5.0.0/ansi.c:1919:45: note: in expansion of macro ‘w_width’
screen-5.0.0-build/screen-5.0.0/ansi.c:1935:48: note: in expansion of macro ‘w_width’
# 1933|   	}
# 1934|   	if (mc->colorfg && ml->colorfg == null) {
# 1935|-> 		if ((ml->colorfg = calloc(win->w_width + 1, 4)) == NULL) {
# 1936|   			ml->colorfg = null;
# 1937|   			mc->colorfg = win->w_rend.colorfg = 0;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def4]
screen-5.0.0-build/screen-5.0.0/attacher.c: scope_hint: In function ‘SendCmdMessage’
screen-5.0.0-build/screen-5.0.0/attacher.c:484:25: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘&query’
#  482|   		for (c = 'A'; c <= 'Z'; c++) {
#  483|   			query[6] = c;
#  484|-> 			strncpy(sp, query, strlen(SocketPath));
#  485|   			if ((r = MakeServerSocket()) >= 0)
#  486|   				break;

Error: GCC_ANALYZER_WARNING (CWE-416): [#def5]
screen-5.0.0-build/screen-5.0.0/canvas.c: scope_hint: In function ‘FreeCanvas’
screen-5.0.0-build/screen-5.0.0/canvas.c:86:15: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘cv’
screen-5.0.0-build/screen-5.0.0/window.h:42: included_from: Included from here.
screen-5.0.0-build/screen-5.0.0/screen.h:72: included_from: Included from here.
screen-5.0.0-build/screen-5.0.0/canvas.c:33: included_from: Included from here.
screen-5.0.0-build/screen-5.0.0/display.h:198:25: note: in expansion of macro ‘DISPLAY’
screen-5.0.0-build/screen-5.0.0/canvas.c:717:16: note: in expansion of macro ‘D_canvas’
screen-5.0.0-build/screen-5.0.0/display.h:201:25: note: in expansion of macro ‘DISPLAY’
screen-5.0.0-build/screen-5.0.0/canvas.c:101:21: note: in expansion of macro ‘D_forecv’
screen-5.0.0-build/screen-5.0.0/display.h:201:25: note: in expansion of macro ‘DISPLAY’
screen-5.0.0-build/screen-5.0.0/canvas.c:270:19: note: in expansion of macro ‘D_forecv’
#   84|   	Window *win;
#   85|   
#   86|-> 	if (cv->c_slprev)
#   87|   		cv->c_slprev->c_slnext = cv->c_slnext;
#   88|   	if (cv->c_slnext)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def6]
screen-5.0.0-build/screen-5.0.0/canvas.c: scope_hint: In function ‘SetCanvasWindow’
screen-5.0.0-build/screen-5.0.0/canvas.c:215:28: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘cvp’
screen-5.0.0-build/screen-5.0.0/display.h:198:25: note: in expansion of macro ‘DISPLAY’
screen-5.0.0-build/screen-5.0.0/canvas.c:717:16: note: in expansion of macro ‘D_canvas’
screen-5.0.0-build/screen-5.0.0/display.h:201:25: note: in expansion of macro ‘DISPLAY’
screen-5.0.0-build/screen-5.0.0/canvas.c:101:21: note: in expansion of macro ‘D_forecv’
screen-5.0.0-build/screen-5.0.0/canvas.c:111:29: note: in expansion of macro ‘Layer2Window’
#  213|   			if (cvp == cv)
#  214|   				break;
#  215|-> 		*cvpp = cvp->c_lnext;
#  216|   
#  217|   		p = Layer2Window(l);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def7]
screen-5.0.0-build/screen-5.0.0/canvas.c:282:40: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘p’
#  280|   					if (p == window)
#  281|   						break;
#  282|-> 				*pp = p->w_prev_mru;
#  283|   				p->w_prev_mru = mru_window;
#  284|   				mru_window = p;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def8]
screen-5.0.0-build/screen-5.0.0/canvas.c: scope_hint: In function ‘DupLayoutCv’
screen-5.0.0-build/screen-5.0.0/canvas.c:760:49: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*cvt.c_slperp’
#  758|   		if (cvf->c_slperp) {
#  759|   			cvt->c_slperp = calloc(1, sizeof(Canvas));
#  760|-> 			cvt->c_slperp->c_slback = cvt;
#  761|   			CanvasInitBlank(cvt->c_slperp);
#  762|   			DupLayoutCv(cvf->c_slperp, cvt->c_slperp, save);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def9]
screen-5.0.0-build/screen-5.0.0/canvas.c:760:49: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘calloc(1, 304)’
#  758|   		if (cvf->c_slperp) {
#  759|   			cvt->c_slperp = calloc(1, sizeof(Canvas));
#  760|-> 			cvt->c_slperp->c_slback = cvt;
#  761|   			CanvasInitBlank(cvt->c_slperp);
#  762|   			DupLayoutCv(cvf->c_slperp, cvt->c_slperp, save);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def10]
screen-5.0.0-build/screen-5.0.0/canvas.c:766:49: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*cvt.c_slnext’
#  764|   		if (cvf->c_slnext) {
#  765|   			cvt->c_slnext = calloc(1, sizeof(Canvas));
#  766|-> 			cvt->c_slnext->c_slprev = cvt;
#  767|   			cvt->c_slnext->c_slback = cvt->c_slback;
#  768|   			CanvasInitBlank(cvt->c_slnext);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def11]
screen-5.0.0-build/screen-5.0.0/canvas.c:766:49: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘calloc(1, 304)’
#  764|   		if (cvf->c_slnext) {
#  765|   			cvt->c_slnext = calloc(1, sizeof(Canvas));
#  766|-> 			cvt->c_slnext->c_slprev = cvt;
#  767|   			cvt->c_slnext->c_slback = cvt->c_slback;
#  768|   			CanvasInitBlank(cvt->c_slnext);

Error: COMPILER_WARNING (CWE-252): [#def12]
screen-5.0.0-build/screen-5.0.0/display.c: scope_hint: In function ‘DisplaySleep1000’
screen-5.0.0-build/screen-5.0.0/display.c:2335:25: warning[-Wunused-result]: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’
# 2335 |                         read(D_userfd, &buf, 1);
#      |                         ^~~~~~~~~~~~~~~~~~~~~~~
# 2333|   	if (poll(pfd, ARRAY_SIZE(pfd), n) > 0) {
# 2334|   		if (eat)
# 2335|-> 			read(D_userfd, &buf, 1);
# 2336|   	}
# 2337|   }

Error: COMPILER_WARNING (CWE-252): [#def13]
screen-5.0.0-build/screen-5.0.0/display.c: scope_hint: In function ‘RunBlanker’
screen-5.0.0-build/screen-5.0.0/display.c:3027:25: warning[-Wunused-result]: ignoring return value of ‘dup’ declared with attribute ‘warn_unused_result’
# 3027 |                         dup(slave);
#      |                         ^~~~~~~~~~
# 3025|   		if (slave != -1) {
# 3026|   			close(0);
# 3027|-> 			dup(slave);
# 3028|   			close(slave);
# 3029|   			closeallfiles(D_blankerev.fd);

Error: GCC_ANALYZER_WARNING (CWE-457): [#def14]
screen-5.0.0-build/screen-5.0.0/fileio.c: scope_hint: In function ‘CatExtra’
screen-5.0.0-build/screen-5.0.0/fileio.c:70:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘cp’
screen-5.0.0-build/screen-5.0.0/window.h:42: included_from: Included from here.
screen-5.0.0-build/screen-5.0.0/fileio.h:4: included_from: Included from here.
screen-5.0.0-build/screen-5.0.0/fileio.c:31: included_from: Included from here.
screen-5.0.0-build/screen-5.0.0/display.h:209:25: note: in expansion of macro ‘DISPLAY’
screen-5.0.0-build/screen-5.0.0/fileio.c:154:34: note: in expansion of macro ‘D_termname’
#   68|   		if ((cp = realloc(str2, len1 + len2 + add_colon + 1)) == NULL)
#   69|   			Panic(0, "%s", strnomem);
#   70|-> 		memmove(cp + len1 + add_colon, cp, len2 + 1);
#   71|   	} else {
#   72|   		if ((cp = malloc(len1 + add_colon + 1)) == NULL)

Error: COMPILER_WARNING: [#def15]
screen-5.0.0-build/screen-5.0.0/fileio.c: scope_hint: In function ‘WriteFile’
screen-5.0.0-build/screen-5.0.0/fileio.c:352:25: warning[-Wstringop-truncation]: ‘__strncpy_chk’ output may be truncated copying between 0 and 4087 bytes from a string of length 4095
#  352 |                         strncpy(fnbuf, SocketPath, i);
#      |                         ^
#  350|   			if (i > (int)ARRAY_SIZE(fnbuf) - 9)
#  351|   				i = 0;
#  352|-> 			strncpy(fnbuf, SocketPath, i);
#  353|   			strncpy(fnbuf + i, ".termcap", 9);
#  354|   			fn = fnbuf;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def16]
screen-5.0.0-build/screen-5.0.0/fileio.c:564:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘pi[0]’
#  562|   	if (pipe(pi)) {
#  563|   		WMsg(p, errno, "printing pipe");
#  564|-> 		return -1;
#  565|   	}
#  566|   	switch (fork()) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def17]
screen-5.0.0-build/screen-5.0.0/fileio.c: scope_hint: In function ‘printpipe’
screen-5.0.0-build/screen-5.0.0/fileio.c:564:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘pi[1]’
#  562|   	if (pipe(pi)) {
#  563|   		WMsg(p, errno, "printing pipe");
#  564|-> 		return -1;
#  565|   	}
#  566|   	switch (fork()) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def18]
screen-5.0.0-build/screen-5.0.0/fileio.c:575:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup(pi[0])’
#  573|   		ServerSocket = -1;
#  574|   		close(0);
#  575|-> 		if (dup(pi[0]) < 0)
#  576|   			Panic(errno, "printpipe dup");
#  577|   		closeallfiles(0);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def19]
screen-5.0.0-build/screen-5.0.0/fileio.c: scope_hint: In function ‘readpipe’
screen-5.0.0-build/screen-5.0.0/fileio.c:600:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘pi[0]’
#  598|   	if (pipe(pi)) {
#  599|   		Msg(errno, "pipe");
#  600|-> 		return -1;
#  601|   	}
#  602|   	switch (fork()) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def20]
screen-5.0.0-build/screen-5.0.0/fileio.c:600:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘pi[1]’
#  598|   	if (pipe(pi)) {
#  599|   		Msg(errno, "pipe");
#  600|-> 		return -1;
#  601|   	}
#  602|   	switch (fork()) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def21]
screen-5.0.0-build/screen-5.0.0/fileio.c:610:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup(pi[1])’
#  608|   		ServerSocket = -1;
#  609|   		close(1);
#  610|-> 		if (dup(pi[1]) != 1) {
#  611|   			close(pi[1]);
#  612|   			Panic(0, "dup");

Error: GCC_ANALYZER_WARNING (CWE-121): [#def22]
screen-5.0.0-build/screen-5.0.0/help.c: scope_hint: In function ‘add_key_to_buf’
screen-5.0.0-build/screen-5.0.0/help.c:329:17: warning[-Wanalyzer-out-of-bounds]: stack-based buffer overflow
screen-5.0.0-build/screen-5.0.0/help.c:329:17: note: write of 1 byte to beyond the end of ‘Esc_buf’
screen-5.0.0-build/screen-5.0.0/help.c:329:17: note: valid subscripts for ‘Esc_buf’ are ‘[0]’ to ‘[4]’
#  327|   	buf += strlen(buf);
#  328|   	if (key < 0)
#  329|-> 		strncpy(buf, "unset", 6);
#  330|   	else if (key == ' ')
#  331|   		strncpy(buf, "sp", 3);

Error: CPPCHECK_WARNING (CWE-457): [#def23]
screen-5.0.0-build/screen-5.0.0/layout.c:229: warning[uninitvar]: Uninitialized variable: ss
#  227|   	}
#  228|   	*s = 0;
#  229|-> 	return ss;
#  230|   }
#  231|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def24]
screen-5.0.0-build/screen-5.0.0/list_generic.c: scope_hint: In function ‘glist_add_row’
screen-5.0.0-build/screen-5.0.0/list_generic.c:372:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘r’
#  370|   {
#  371|   	ListRow *r = calloc(1, sizeof(ListRow));
#  372|-> 	r->data = data;
#  373|   
#  374|   	if (after) {

Error: COMPILER_WARNING: [#def25]
screen-5.0.0-build/screen-5.0.0/list_license.c: scope_hint: In function ‘gl_License_row’
screen-5.0.0-build/screen-5.0.0/list_license.c:99:36: warning[-Wcalloc-transposed-args]: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument
#   99 |         char *line = calloc(sizeof(char), flayer->l_width + 1);
#      |                                    ^~~~
screen-5.0.0-build/screen-5.0.0/list_license.c:99:36: note: earlier argument should specify number of elements, later size of each element
#   97|   	(void)ldata; /* unused */
#   98|   
#   99|-> 	char *line = calloc(sizeof(char), flayer->l_width + 1);
#  100|   	char *start = (char *)lrow->data;
#  101|   	char *lastspace = start;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def26]
screen-5.0.0-build/screen-5.0.0/logfile.c: scope_hint: In function ‘logfile_reopen’
screen-5.0.0-build/screen-5.0.0/logfile.c:75:16: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘lf_move_fd(open(name, 1089, 438), wantfd)’
#   73|   	if (fd == need_fd)
#   74|   		return fd;
#   75|-> 	if (fd >= 0 && fd < need_fd)
#   76|   		r = lf_move_fd(dup(fd), need_fd);
#   77|   	close(fd);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def27]
screen-5.0.0-build/screen-5.0.0/logfile.c:222:50: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fileno(*l.fp)’
#  220|   	if (!l)
#  221|   		for (l = logroot; l; l = l->next) {
#  222|-> 			if (stolen_logfile(l) && logfile_reopen(l->name, fileno(l->fp), l))
#  223|   				return -1;
#  224|   			r |= fflush(l->fp);

Error: COMPILER_WARNING (CWE-457): [#def28]
screen-5.0.0-build/screen-5.0.0/process.c: scope_hint: In function ‘DoCommandAt’
screen-5.0.0-build/screen-5.0.0/process.c:1372:36: warning[-Wmaybe-uninitialized]: ‘i’ may be used uninitialized
# 1372 |                                 if (i < 0)
#      |                                    ^
screen-5.0.0-build/screen-5.0.0/process.c:1340:29: note: ‘i’ was declared here
# 1340 |                         int i;
#      |                             ^
# 1370|   				display = NULL;
# 1371|   				fore = NULL;
# 1372|-> 				if (i < 0)
# 1373|   					OutputMsg(0, "%s: at '%s': no such window.\n", rc_name, args[0]);
# 1374|   				goto out;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def29]
screen-5.0.0-build/screen-5.0.0/resize.c: scope_hint: In function ‘FreeMline’
screen-5.0.0-build/screen-5.0.0/resize.c:307:15: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ml’
screen-5.0.0-build/screen-5.0.0/resize.c: scope_hint: In function ‘FreeMline’
screen-5.0.0-build/screen-5.0.0/resize.h:4: included_from: Included from here.
screen-5.0.0-build/screen-5.0.0/resize.c:31: included_from: Included from here.
screen-5.0.0-build/screen-5.0.0/resize.c:496:30: note: in expansion of macro ‘w_width’
screen-5.0.0-build/screen-5.0.0/resize.c:521:16: note: in expansion of macro ‘w_width’
#  305|   static void FreeMline(struct mline *ml)
#  306|   {
#  307|-> 	if (ml->image)
#  308|   		free(ml->image);
#  309|   	if (ml->attr && ml->attr != null)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def30]
screen-5.0.0-build/screen-5.0.0/resize.c: scope_hint: In function ‘AllocMline’
screen-5.0.0-build/screen-5.0.0/resize.c:322:19: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ml’
screen-5.0.0-build/screen-5.0.0/resize.c: scope_hint: In function ‘AllocMline’
screen-5.0.0-build/screen-5.0.0/resize.c:496:30: note: in expansion of macro ‘w_width’
screen-5.0.0-build/screen-5.0.0/resize.c:521:16: note: in expansion of macro ‘w_width’
#  320|   static int AllocMline(struct mline *ml, int w)
#  321|   {
#  322|-> 	ml->image = malloc(w * 4);
#  323|   	ml->attr = null;
#  324|   	ml->font = null;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def31]
screen-5.0.0-build/screen-5.0.0/resize.c: scope_hint: In function ‘ChangeWindowSize’
screen-5.0.0-build/screen-5.0.0/resize.c:573:32: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘mlf’
screen-5.0.0-build/screen-5.0.0/resize.c: scope_hint: In function ‘ChangeWindowSize’
screen-5.0.0-build/screen-5.0.0/resize.c:496:30: note: in expansion of macro ‘w_width’
screen-5.0.0-build/screen-5.0.0/resize.c:521:16: note: in expansion of macro ‘w_width’
screen-5.0.0-build/screen-5.0.0/resize.c:560:24: note: in expansion of macro ‘w_width’
#  571|   		/* calculate lenght */
#  572|   		for (l = p->w_width - 1; l > 0; l--)
#  573|-> 			if (mlf->image[l] != ' ' || mlf->attr[l])
#  574|   				break;
#  575|   		if (fy == p->w_y + p->w_histheight && l < p->w_x)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def32]
screen-5.0.0-build/screen-5.0.0/resize.c:593:32: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘mlt’
screen-5.0.0-build/screen-5.0.0/resize.c: scope_hint: In function ‘ChangeWindowSize’
screen-5.0.0-build/screen-5.0.0/resize.c:496:30: note: in expansion of macro ‘w_width’
screen-5.0.0-build/screen-5.0.0/resize.c:521:16: note: in expansion of macro ‘w_width’
screen-5.0.0-build/screen-5.0.0/resize.c:560:24: note: in expansion of macro ‘w_width’
screen-5.0.0-build/screen-5.0.0/resize.c:575:30: note: in expansion of macro ‘w_y’
#  591|   		while (l > 0 && fy >= 0 && ty >= 0) {
#  592|   			lx = lt > lf ? lf : lt;
#  593|-> 			if (mlt->image == NULL) {
#  594|   				if (AllocMline(mlt, wi + 1))
#  595|   					goto nomem;

Error: CPPCHECK_WARNING (CWE-401): [#def33]
screen-5.0.0-build/screen-5.0.0/sched.c:78: error[memleakOnRealloc]: Common realloc mistake: 'pfd' nulled but not freed upon failure
#   76|   	if (i > pfd_cnt) {
#   77|   		pfd_cnt = i;
#   78|-> 		pfd = realloc(pfd, pfd_cnt * sizeof(struct pollfd));
#   79|   	}
#   80|   }

Error: COMPILER_WARNING: [#def34]
screen-5.0.0-build/screen-5.0.0/screen.c: scope_hint: In function ‘main’
screen-5.0.0-build/screen-5.0.0/screen.c:955:102: warning[-Wformat-truncation=]: ‘%s’ directive output may be truncated writing up to 4096 bytes into a region of size 4095
#  955 |                 snprintf(SocketPath + strlen(SocketPath), sizeof(SocketPath) - strlen(SocketPath), "/%s", socknamebuf);
#      |                                                                                                      ^~   ~~~~~~~~~~~
/usr/include/bits/stdio2.h:68:10: note: ‘__snprintf_chk’ output between 2 and 4098 bytes into a destination of size 4096
#   68 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
#      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   69 |                                    __glibc_objsize (__s), __fmt,
#      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   70 |                                    __va_arg_pack ());
#      |                                    ~~~~~~~~~~~~~~~~~
#  953|   		if (strlen(socknamebuf) > FILENAME_MAX)
#  954|   			socknamebuf[FILENAME_MAX - 1] = 0;
#  955|-> 		snprintf(SocketPath + strlen(SocketPath), sizeof(SocketPath) - strlen(SocketPath), "/%s", socknamebuf);
#  956|   		SET_GUID();
#  957|   		Attacher();

Error: COMPILER_WARNING: [#def35]
screen-5.0.0-build/screen-5.0.0/screen.c: scope_hint: In function ‘main’
screen-5.0.0-build/screen-5.0.0/screen.c:1020:94: warning[-Wformat-truncation=]: ‘%s’ directive output may be truncated writing up to 4096 bytes into a region of size 4095
# 1020 |         snprintf(SocketPath + strlen(SocketPath), sizeof(SocketPath) - strlen(SocketPath), "/%s", socknamebuf);
#      |                                                                                              ^~   ~~~~~~~~~~~
/usr/include/bits/stdio2.h:68:10: note: ‘__snprintf_chk’ output between 2 and 4098 bytes into a destination of size 4096
#   68 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
#      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   69 |                                    __glibc_objsize (__s), __fmt,
#      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   70 |                                    __va_arg_pack ());
#      |                                    ~~~~~~~~~~~~~~~~~
# 1018|   		socknamebuf[FILENAME_MAX] = 0;
# 1019|   	}
# 1020|-> 	snprintf(SocketPath + strlen(SocketPath), sizeof(SocketPath) - strlen(SocketPath), "/%s", socknamebuf);
# 1021|   
# 1022|   	ServerSocket = MakeServerSocket();

Error: COMPILER_WARNING (CWE-252): [#def36]
screen-5.0.0-build/screen-5.0.0/screen.c: scope_hint: In function ‘CoreDump’
screen-5.0.0-build/screen-5.0.0/screen.c:1178:17: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
# 1178 |                 write(disp->d_userfd, buf, strlen(buf));
#      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1176|   		fcntl(disp->d_userfd, F_SETFL, 0);
# 1177|   		SetTTY(disp->d_userfd, &D_OldMode);
# 1178|-> 		write(disp->d_userfd, buf, strlen(buf));
# 1179|   		Kill(disp->d_userpid, SIG_BYE);
# 1180|   	}

Error: COMPILER_WARNING (CWE-252): [#def37]
screen-5.0.0-build/screen-5.0.0/screen.c: scope_hint: In function ‘Msg’
screen-5.0.0-build/screen-5.0.0/screen.c:1513:17: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
# 1513 |                 write(queryflag, buf, strlen(buf));
#      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1511|   
# 1512|   	if (queryflag >= 0)
# 1513|-> 		write(queryflag, buf, strlen(buf));
# 1514|   }
# 1515|   

Error: COMPILER_WARNING (CWE-252): [#def38]
screen-5.0.0-build/screen-5.0.0/screen.c: scope_hint: In function ‘Panic’
screen-5.0.0-build/screen-5.0.0/screen.c:1548:25: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
# 1548 |                         write(D_userfd, buf, strlen(buf));
#      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1546|   			SetTTY(D_userfd, &D_OldMode);
# 1547|   			fcntl(D_userfd, F_SETFL, 0);
# 1548|-> 			write(D_userfd, buf, strlen(buf));
# 1549|   			write(D_userfd, "\n", 1);
# 1550|   			freetty();

Error: COMPILER_WARNING (CWE-252): [#def39]
screen-5.0.0-build/screen-5.0.0/screen.c:1549:25: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
# 1549 |                         write(D_userfd, "\n", 1);
#      |                         ^~~~~~~~~~~~~~~~~~~~~~~~
# 1547|   			fcntl(D_userfd, F_SETFL, 0);
# 1548|   			write(D_userfd, buf, strlen(buf));
# 1549|-> 			write(D_userfd, "\n", 1);
# 1550|   			freetty();
# 1551|   			if (D_userpid)

Error: COMPILER_WARNING (CWE-252): [#def40]
screen-5.0.0-build/screen-5.0.0/screen.c: scope_hint: In function ‘QueryMsg’
screen-5.0.0-build/screen-5.0.0/screen.c:1574:9: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
# 1574 |         write(queryflag, buf, strlen(buf));
#      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1572|   
# 1573|   	PROCESS_MESSAGE(buf);
# 1574|-> 	write(queryflag, buf, strlen(buf));
# 1575|   }
# 1576|   

Error: COMPILER_WARNING (CWE-252): [#def41]
screen-5.0.0-build/screen-5.0.0/screen.c: scope_hint: In function ‘serv_select_fn’
screen-5.0.0-build/screen-5.0.0/screen.c:1678:25: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
# 1678 |                         write(W_UWP(fore) ? fore->w_pwin->p_ptyfd : fore->w_ptyfd, &ibuf, 1);
#      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1676|   		if (fore && displays) {
# 1677|   			char ibuf = displays->d_OldMode.tio.c_cc[VINTR];
# 1678|-> 			write(W_UWP(fore) ? fore->w_pwin->p_ptyfd : fore->w_ptyfd, &ibuf, 1);
# 1679|   		}
# 1680|   		InterruptPlease = 0;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def42]
screen-5.0.0-build/screen-5.0.0/socket.c: scope_hint: In function ‘ReceiveMsg’
screen-5.0.0-build/screen-5.0.0/socket.c:845:29: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
#  843|   	case MSG_ERROR:
#  844|   		{
#  845|-> 			int blocked = D_blocked;
#  846|   			if (D_blocked == 4)	/* allow error messages while in blanker mode */
#  847|   				D_blocked = 0;	/* likely they're from failed blanker */

Error: COMPILER_WARNING: [#def43]
screen-5.0.0-build/screen-5.0.0/socket.c: scope_hint: In function ‘ReceiveMsg’
screen-5.0.0-build/screen-5.0.0/socket.c:870:25: warning[-Wstringop-truncation]: ‘strncpy’ specified bound 4096 equals destination size
#  870 |                         strncpy(SocketPath, oldSocketPath, ARRAY_SIZE(SocketPath));
#      |                         ^
#  868|   			strncpy(SocketPath, m.m.command.writeback, ARRAY_SIZE(SocketPath));
#  869|   			int s = MakeClientSocket(0);
#  870|-> 			strncpy(SocketPath, oldSocketPath, ARRAY_SIZE(SocketPath));
#  871|   			Free(oldSocketPath);
#  872|   			if (s >= 0) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def44]
screen-5.0.0-build/screen-5.0.0/socket.c: scope_hint: In function ‘CheckPassword’
screen-5.0.0-build/screen-5.0.0/socket.c:1169:23: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘reply’
# 1167|   	reply = (struct pam_response *)malloc(sizeof(struct pam_response));  
# 1168|   
# 1169|-> 	reply[0].resp = strdup(password);  
# 1170|   	reply[0].resp_retcode = 0;  
# 1171|   

Error: GCC_ANALYZER_WARNING (CWE-787): [#def45]
screen-5.0.0-build/screen-5.0.0/termcap.c: scope_hint: In function ‘MakeTermcap’
screen-5.0.0-build/screen-5.0.0/termcap.c:682:25: warning[-Wanalyzer-out-of-bounds]: buffer overflow
screen-5.0.0-build/screen-5.0.0/termcap.c:682:25: note: write of 5 bytes to beyond the end of ‘Term’
screen-5.0.0-build/screen-5.0.0/termcap.c:682:25: note: valid subscripts for ‘Term’ are ‘[0]’ to ‘[772]’
#  680|   		p = Term + 5;
#  681|   		if (!aflag && strlen(screenterm) + strlen(tname) < MAXSTR - 1) {
#  682|-> 			sprintf(p, "%s.%s", screenterm, tname);
#  683|   			if (e_tgetent(buf, p) == 1)
#  684|   				break;

Error: GCC_ANALYZER_WARNING (CWE-787): [#def46]
screen-5.0.0-build/screen-5.0.0/termcap.c:687:25: warning[-Wanalyzer-out-of-bounds]: buffer overflow
screen-5.0.0-build/screen-5.0.0/termcap.c:687:25: note: write of 5 bytes to beyond the end of ‘Term’
screen-5.0.0-build/screen-5.0.0/termcap.c:687:25: note: valid subscripts for ‘Term’ are ‘[0]’ to ‘[772]’
#  685|   		}
#  686|   		if (nwin_default.bce) {
#  687|-> 			sprintf(p, "%s-bce", screenterm);
#  688|   			if (e_tgetent(buf, p) == 1)
#  689|   				break;

Error: COMPILER_WARNING (CWE-252): [#def47]
screen-5.0.0-build/screen-5.0.0/window.c: scope_hint: In function ‘CloseDevice’
screen-5.0.0-build/screen-5.0.0/window.c:808:23: warning[-Wunused-result]: ignoring return value of ‘chown’ declared with attribute ‘warn_unused_result’
#  808 |                 (void)chown(window->w_tty, 0, 0);
#      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
#  806|   		/* pty 4 SALE */
#  807|   		(void)chmod(window->w_tty, 0666);
#  808|-> 		(void)chown(window->w_tty, 0, 0);
#  809|   		ClosePTY(window->w_ptyfd);
#  810|   		break;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def48]
screen-5.0.0-build/screen-5.0.0/window.c: scope_hint: In function ‘ForkWindow’
screen-5.0.0-build/screen-5.0.0/window.c:1075:27: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup(slave)’
# 1073|   		if (slave != -1) {
# 1074|   			close(0);
# 1075|-> 			if(dup(slave) < 0)
# 1076|   				Panic(errno, "Cannot duplicate file descriptor");
# 1077|   			close(slave);

Error: GCC_ANALYZER_WARNING (CWE-910): [#def49]
screen-5.0.0-build/screen-5.0.0/window.c:1079:33: warning[-Wanalyzer-fd-use-after-close]: ‘dup’ on closed file descriptor ‘0’
# 1077|   			close(slave);
# 1078|   			closeallfiles(win->w_ptyfd);
# 1079|-> 			slave = dup(0);
# 1080|   		} else
# 1081|   			closeallfiles(win->w_ptyfd);

Error: GCC_ANALYZER_WARNING (CWE-1341): [#def50]
screen-5.0.0-build/screen-5.0.0/window.c:1083:17: warning[-Wanalyzer-fd-double-close]: double ‘close’ of file descriptor ‘0’
# 1081|   			closeallfiles(win->w_ptyfd);
# 1082|   		/* Close the three /dev/null descriptors */
# 1083|-> 		close(0);
# 1084|   		close(1);
# 1085|   		close(2);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def51]
screen-5.0.0-build/screen-5.0.0/window.c:1112:35: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup(*win.w_ptyfd)’
# 1110|   					Msg(errno, "fgtty");
# 1111|   			} else {
# 1112|-> 				if(dup(win->w_ptyfd) < 0)
# 1113|   					Panic(errno, "Cannot duplicate file descriptor");
# 1114|   				wfdused = 1;

Error: COMPILER_WARNING (CWE-252): [#def52]
screen-5.0.0-build/screen-5.0.0/window.c: scope_hint: In function ‘FreePseudowin’
screen-5.0.0-build/screen-5.0.0/window.c:1372:15: warning[-Wunused-result]: ignoring return value of ‘chown’ declared with attribute ‘warn_unused_result’
# 1372 |         (void)chown(pwin->p_tty, 0, 0);
#      |               ^~~~~~~~~~~~~~~~~~~~~~~~
# 1370|   	/* should be able to use CloseDevice() here */
# 1371|   	(void)chmod(pwin->p_tty, 0666);
# 1372|-> 	(void)chown(pwin->p_tty, 0, 0);
# 1373|   	if (pwin->p_ptyfd >= 0) {
# 1374|   		if (w->w_type == W_TYPE_PTY)

Error: COMPILER_WARNING (CWE-252): [#def53]
screen-5.0.0-build/screen-5.0.0/window.c: scope_hint: In function ‘win_writeev_fn’
screen-5.0.0-build/screen-5.0.0/window.c:1574:41: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
# 1574 |                                         write(win->w_ptyfd, p->w_inbuf, p->w_inlen);
#      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1572|   			for (Window *win = mru_window; win; win = win->w_prev_mru) {
# 1573|   				if (win != p && win->w_miflag)
# 1574|-> 					write(win->w_ptyfd, p->w_inbuf, p->w_inlen);
# 1575|   			}
# 1576|   		}

Error: GCC_ANALYZER_WARNING (CWE-476): [#def54]
screen-5.0.0-build/screen-5.0.0/window.c: scope_hint: In function ‘SwapWindows’
screen-5.0.0-build/screen-5.0.0/window.c:1853:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
# 1851|   
# 1852|   	remove_window_from_list(win_a);
# 1853|-> 	win_a->w_number = dest;
# 1854|   	if (win_b) {
# 1855|   		remove_window_from_list(win_b);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def55]
screen-5.0.0-build/screen-5.0.0/window.c: scope_hint: In function ‘GetWindowByNumber’
screen-5.0.0-build/screen-5.0.0/window.c:2008:22: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘w’
# 2006|   				w = w->w_prev;
# 2007|   		}
# 2008|-> 		if (w->w_number == n)
# 2009|   			return w;
# 2010|   	}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def56]
screen-5.0.0-build/screen-5.0.0/winmsgbuf.c: scope_hint: In function ‘wmb_expand’
screen-5.0.0-build/screen-5.0.0/winmsgbuf.c:77:19: warning[-Wanalyzer-malloc-leak]: leak of ‘p’
screen-5.0.0-build/screen-5.0.0/winmsgbuf.c: scope_hint: In function ‘wmb_expand’
screen-5.0.0-build/screen-5.0.0/winmsgbuf.c:29: included_from: Included from here.
screen-5.0.0-build/screen-5.0.0/winmsgbuf.c: scope_hint: In function ‘wmb_expand’
#   75|   	/* realloc already handled the free for us */
#   76|   	wmb->buf = p;
#   77|-> 	wmb->size = size;
#   78|   	return size;
#   79|   }

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-190.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namescreen-5.0.0-1.fc42
store-results-to/tmp/tmpjm8p_uwq/screen-5.0.0-1.fc42.tar.xz
time-created2024-11-13 03:25:49
time-finished2024-11-13 03:28:25
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpjm8p_uwq/screen-5.0.0-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpjm8p_uwq/screen-5.0.0-1.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9