Task #1244 - screen-4.9.1-1.fc41/scan-results.err
back to task #1244download
Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/acls.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/acls.c:110:18: warning[unix.Malloc]: Use of memory allocated with size zero # 108| for (i = 0; i < (len + delta); i++) { # 109| if (((i < len) && (ACLBIT(i) & ACLBYTE(o, i))) || ((i >= len) && (defaultbit))) # 110|-> ACLBYTE(n, i) |= ACLBIT(i); # 111| } # 112| if (len) Error: CPPCHECK_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/acls.c:664: warning[nullPointer]: Possible null pointer dereference: win # 662| } else { # 663| ASSERT(win); # 664|-> bitarray = win->w_userbits; # 665| debug3("AclSetPermWin %s %s %d\n", u->u_name, mode, win->w_number); # 666| } Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/acls.c:904:11: warning[deadcode.DeadStores]: Although the value stored to 'r' is used in the enclosing expression, the value is never actually read from 'r' # 902| for (u = &users; *u; u = &(*u)->u_next) # 903| if (strcmp("nobody", (*u)->u_name) && ((cf_u) ? # 904|-> ((r = UserAclCopy(u, cf_u)) < 0) : # 905| ((r = UserAcl(uu, u, argc, argv)) < 0))) # 906| return -1; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/acls.c:905:11: warning[deadcode.DeadStores]: Although the value stored to 'r' is used in the enclosing expression, the value is never actually read from 'r' # 903| if (strcmp("nobody", (*u)->u_name) && ((cf_u) ? # 904| ((r = UserAclCopy(u, cf_u)) < 0) : # 905|-> ((r = UserAcl(uu, u, argc, argv)) < 0))) # 906| return -1; # 907| return 0; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/acls.c:918:9: warning[deadcode.DeadStores]: Although the value stored to 'r' is used in the enclosing expression, the value is never actually read from 'r' # 916| debug2("UsersAcl(uu, \"%s\", argc=%d)\n", argv[0], argc); # 917| if ((cf_u) ? # 918|-> ((r = UserAclCopy(FindUserPtr(argv[0]), cf_u)) < 0) : # 919| ((r = UserAcl(uu, FindUserPtr(argv[0]), argc, argv)) < 0)) # 920| return -1; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/acls.c:919:9: warning[deadcode.DeadStores]: Although the value stored to 'r' is used in the enclosing expression, the value is never actually read from 'r' # 917| if ((cf_u) ? # 918| ((r = UserAclCopy(FindUserPtr(argv[0]), cf_u)) < 0) : # 919|-> ((r = UserAcl(uu, FindUserPtr(argv[0]), argc, argv)) < 0)) # 920| return -1; # 921| } while (*(argv[0] = s)); Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/ansi.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/ansi.c:817:5: warning[deadcode.DeadStores]: Value stored to 'font' is never read # 815| if (font == '<' && c >= ' ') # 816| { # 817|-> font = curr->w_rend.font = 0; # 818| c |= 0x80; # 819| } Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/ansi.c:2043:7: warning[deadcode.DeadStores]: Value stored to 'x' is never read # 2041| { # 2042| LineFeed(1); # 2043|-> x = 0; # 2044| } # 2045| if ((curr->w_x += n) >= cols) Error: GCC_ANALYZER_WARNING (CWE-401): screen-4.9.1-build/screen-4.9.1/ansi.c: scope_hint: In function ‘MFixLine’ screen-4.9.1-build/screen-4.9.1/ansi.c:2390:10: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc((long unsigned int)(*p.w_layer.l_width + 1), 1)’ screen-4.9.1-build/screen-4.9.1/screen.h:151: included_from: Included from here. screen-4.9.1-build/screen-4.9.1/ansi.c:36: included_from: Included from here. screen-4.9.1-build/screen-4.9.1/ansi.c:2390:50: note: in expansion of macro ‘w_width’ # 2388| if (mc->attr && ml->attr == null) # 2389| { # 2390|-> if ((ml->attr = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) # 2391| { # 2392| ml->attr = null; Error: GCC_ANALYZER_WARNING (CWE-401): screen-4.9.1-build/screen-4.9.1/ansi.c:2400:10: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc((long unsigned int)(*p.w_layer.l_width + 1), 1)’ screen-4.9.1-build/screen-4.9.1/ansi.c:2400:50: note: in expansion of macro ‘w_width’ # 2398| if (mc->font && ml->font == null) # 2399| { # 2400|-> if ((ml->font = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) # 2401| { # 2402| ml->font = null; Error: GCC_ANALYZER_WARNING (CWE-401): screen-4.9.1-build/screen-4.9.1/ansi.c:2411:10: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc((long unsigned int)(*p.w_layer.l_width + 1), 1)’ screen-4.9.1-build/screen-4.9.1/ansi.c:2390:50: note: in expansion of macro ‘w_width’ screen-4.9.1-build/screen-4.9.1/ansi.c:2400:50: note: in expansion of macro ‘w_width’ screen-4.9.1-build/screen-4.9.1/ansi.c:2411:51: note: in expansion of macro ‘w_width’ # 2409| if (mc->fontx && ml->fontx == null) # 2410| { # 2411|-> if ((ml->fontx = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) # 2412| { # 2413| ml->fontx = null; Error: GCC_ANALYZER_WARNING (CWE-401): screen-4.9.1-build/screen-4.9.1/ansi.c:2421:10: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc((long unsigned int)(*p.w_layer.l_width + 1), 1)’ screen-4.9.1-build/screen-4.9.1/ansi.c:2390:50: note: in expansion of macro ‘w_width’ screen-4.9.1-build/screen-4.9.1/ansi.c:2411:51: note: in expansion of macro ‘w_width’ screen-4.9.1-build/screen-4.9.1/ansi.c:2421:51: note: in expansion of macro ‘w_width’ # 2419| if (mc->color && ml->color == null) # 2420| { # 2421|-> if ((ml->color = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) # 2422| { # 2423| ml->color = null; Error: GCC_ANALYZER_WARNING (CWE-401): screen-4.9.1-build/screen-4.9.1/ansi.c:2431:10: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc((long unsigned int)(*p.w_layer.l_width + 1), 1)’ screen-4.9.1-build/screen-4.9.1/ansi.c:2390:50: note: in expansion of macro ‘w_width’ screen-4.9.1-build/screen-4.9.1/ansi.c:2411:51: note: in expansion of macro ‘w_width’ screen-4.9.1-build/screen-4.9.1/ansi.c:2431:52: note: in expansion of macro ‘w_width’ # 2429| if (mc->colorx && ml->colorx == null) # 2430| { # 2431|-> if ((ml->colorx = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) # 2432| { # 2433| ml->colorx = null; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/ansi.c:3132:3: warning[deadcode.DeadStores]: Value stored to 'inwstr' is never read # 3130| struct canvas *cv; # 3131| # 3132|-> inwstr = inhstr = 0; # 3133| # 3134| if (what == 'f') Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/ansi.c:3132:12: warning[deadcode.DeadStores]: Although the value stored to 'inhstr' is used in the enclosing expression, the value is never actually read from 'inhstr' # 3130| struct canvas *cv; # 3131| # 3132|-> inwstr = inhstr = 0; # 3133| # 3134| if (what == 'f') Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/attacher.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-401): screen-4.9.1-build/screen-4.9.1/attacher.c: scope_hint: In function ‘PAM_conv’ screen-4.9.1-build/screen-4.9.1/attacher.c:860:11: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’ # 858| default: # 859| /* unknown or PAM_ERROR_MSG */ # 860|-> free(reply); # 861| return PAM_CONV_ERR; # 862| } Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/attacher.c:988:23: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 986| else # 987| { # 988|-> char *buf = crypt(cp1, pass); # 989| if (buf && !strncmp(buf, pass, strlen(pass))) # 990| break; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/attacher.c:993:18: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 991| } # 992| debug("screen_builtin_lck: NO!!!!!\n"); # 993|-> bzero(cp1, strlen(cp1)); # 994| } # 995| bzero(cp1, strlen(cp1)); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/attacher.c:995:14: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 993| bzero(cp1, strlen(cp1)); # 994| } # 995|-> bzero(cp1, strlen(cp1)); # 996| debug("password ok.\n"); # 997| } Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/braille.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/braille.c:279:8: warning[deadcode.DeadStores]: Value stored to 'bx' during its initialization is never read # 277| { # 278| int sx = bd.bd_sx; # 279|-> int bx = BD_FORE->w_bd_x; # 280| int eol = BD_FORE->w_width; # 281| int w = bd.bd_width; Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/braille_tsi.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/braille_tsi.c:99:2: warning[deadcode.DeadStores]: Value stored to 'r' is never read # 97| obuf[1] = 0xff; # 98| obuf[2] = 0x0a; # 99|-> r = read(bd.bd_fd, ibuf, 20); /* flush the input port */ # 100| r = write(bd.bd_fd, obuf, 3); # 101| if (r != 3) Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/canvas.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-416): screen-4.9.1-build/screen-4.9.1/canvas.c: scope_hint: In function ‘FreeCanvas’ screen-4.9.1-build/screen-4.9.1/canvas.c:97:9: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘cv’ screen-4.9.1-build/screen-4.9.1/screen.h:150: included_from: Included from here. screen-4.9.1-build/screen-4.9.1/canvas.c:30: included_from: Included from here. screen-4.9.1-build/screen-4.9.1/display.h:201:25: note: in expansion of macro ‘DISPLAY’ screen-4.9.1-build/screen-4.9.1/canvas.c:836:10: note: in expansion of macro ‘D_canvas’ screen-4.9.1-build/screen-4.9.1/display.h:204:25: note: in expansion of macro ‘DISPLAY’ screen-4.9.1-build/screen-4.9.1/canvas.c:114:11: note: in expansion of macro ‘D_forecv’ screen-4.9.1-build/screen-4.9.1/display.h:204:25: note: in expansion of macro ‘DISPLAY’ screen-4.9.1-build/screen-4.9.1/canvas.c:318:13: note: in expansion of macro ‘D_forecv’ # 95| struct win *p; # 96| # 97|-> if (cv->c_slprev) # 98| cv->c_slprev->c_slnext = cv->c_slnext; # 99| if (cv->c_slnext) Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/canvas.c:106:2: warning[unix.Malloc]: Use of memory after it is freed # 104| { # 105| while (cv->c_slperp) # 106|-> FreeCanvas(cv->c_slperp); # 107| LayerCleanupMemory(&cv->c_blank); # 108| free(cv); Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/canvas.c: scope_hint: In function ‘SetCanvasWindow’ screen-4.9.1-build/screen-4.9.1/canvas.c:254:18: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘cvp’ screen-4.9.1-build/screen-4.9.1/display.h:201:25: note: in expansion of macro ‘DISPLAY’ screen-4.9.1-build/screen-4.9.1/canvas.c:836:10: note: in expansion of macro ‘D_canvas’ screen-4.9.1-build/screen-4.9.1/display.h:204:25: note: in expansion of macro ‘DISPLAY’ screen-4.9.1-build/screen-4.9.1/canvas.c:114:11: note: in expansion of macro ‘D_forecv’ screen-4.9.1-build/screen-4.9.1/screen.h:151: included_from: Included from here. screen-4.9.1-build/screen-4.9.1/canvas.c:125:21: note: in expansion of macro ‘Layer2Window’ # 252| break; # 253| ASSERT(cvp); # 254|-> *cvpp = cvp->c_lnext; # 255| # 256| p = Layer2Window(l); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/canvas.c:336:14: warning[core.NullDereference]: Access to field 'w_next' results in a dereference of a null pointer (loaded from variable 'p') # 334| break; # 335| ASSERT(p); # 336|-> *pp = p->w_next; # 337| p->w_next = windows; # 338| windows = p; Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/canvas.c:336:22: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘p’ # 334| break; # 335| ASSERT(p); # 336|-> *pp = p->w_next; # 337| p->w_next = windows; # 338| windows = p; Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/canvas.c: scope_hint: In function ‘DupLayoutCv’ screen-4.9.1-build/screen-4.9.1/canvas.c:885:35: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*cvt.c_slperp’ # 883| { # 884| cvt->c_slperp = (struct canvas *)calloc(1, sizeof(struct canvas)); # 885|-> cvt->c_slperp->c_slback = cvt; # 886| CanvasInitBlank(cvt->c_slperp); # 887| DupLayoutCv(cvf->c_slperp, cvt->c_slperp, save); Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/canvas.c:885:35: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘calloc(1, 312)’ # 883| { # 884| cvt->c_slperp = (struct canvas *)calloc(1, sizeof(struct canvas)); # 885|-> cvt->c_slperp->c_slback = cvt; # 886| CanvasInitBlank(cvt->c_slperp); # 887| DupLayoutCv(cvf->c_slperp, cvt->c_slperp, save); Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/canvas.c:892:35: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*cvt.c_slnext’ # 890| { # 891| cvt->c_slnext = (struct canvas *)calloc(1, sizeof(struct canvas)); # 892|-> cvt->c_slnext->c_slprev = cvt; # 893| cvt->c_slnext->c_slback = cvt->c_slback; # 894| CanvasInitBlank(cvt->c_slnext); Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/canvas.c:892:35: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘calloc(1, 312)’ # 890| { # 891| cvt->c_slnext = (struct canvas *)calloc(1, sizeof(struct canvas)); # 892|-> cvt->c_slnext->c_slprev = cvt; # 893| cvt->c_slnext->c_slback = cvt->c_slback; # 894| CanvasInitBlank(cvt->c_slnext); Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/display.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-697): screen-4.9.1-build/screen-4.9.1/display.c: scope_hint: In function ‘SetRendition’ screen-4.9.1-build/screen-4.9.1/display.c:1876:13: warning[-Waddress]: the comparison will always evaluate as ‘true’ for the address of ‘attr2color’ will never be NULL # 1876 | if (attr2color[i] && (mc->attr & (1 << i)) != 0) # | ^~~~~~~~~~ screen-4.9.1-build/screen-4.9.1/display.c:120:6: note: ‘attr2color’ declared here # 120 | int attr2color[8][4]; # | ^~~~~~~~~~ # 1874| mmc = *mc; # 1875| for (i = 0; i < 8; i++) # 1876|-> if (attr2color[i] && (mc->attr & (1 << i)) != 0) # 1877| { # 1878| if (mc->color == 0 && attr2color[i][3]) Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/display.c:2048:5: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 2046| } # 2047| if (t - msg < D_status_buflen) # 2048|-> strcpy(D_status_lastmsg, msg); # 2049| D_status_len = t - msg; # 2050| D_status_lastx = D_x; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/display.c:2667:11: warning[core.NullDereference]: Access to field 'font' results in a dereference of a null pointer (loaded from variable 'ml') # 2665| } # 2666| #ifdef DW_CHARS # 2667|-> if (dw_right(ml, x, D_encoding)) # 2668| { # 2669| x--; Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/display.c: scope_hint: In function ‘DisplaySleep1000’ screen-4.9.1-build/screen-4.9.1/display.c:3186:9: warning[-Wunused-result]: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’ # 3186 | read(D_userfd, &buf, 1); # | ^~~~~~~~~~~~~~~~~~~~~~~ # 3184| debug("display activity stopped sleep\n"); # 3185| if (eat) # 3186|-> read(D_userfd, &buf, 1); # 3187| } # 3188| debug2("DisplaySleep(%d) ending, eat was %d\n", n, eat); Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/display.c: scope_hint: In function ‘RunBlanker’ screen-4.9.1-build/screen-4.9.1/display.c:4019:11: warning[-Wunused-result]: ignoring return value of ‘dup’ declared with attribute ‘warn_unused_result’ # 4019 | dup(slave); # | ^~~~~~~~~~ # 4017| { # 4018| close(0); # 4019|-> dup(slave); # 4020| close(slave); # 4021| closeallfiles(D_blankerev.fd); Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/display.c:4044:7: warning[-Wunused-result]: ignoring return value of ‘dup’ declared with attribute ‘warn_unused_result’ # 4044 | dup(0); # | ^~~~~~ # 4042| if (open(m, O_RDWR)) # 4043| Panic(errno, "Cannot open %s", m); # 4044|-> dup(0); # 4045| dup(0); # 4046| close(D_blankerev.fd); Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/display.c:4045:7: warning[-Wunused-result]: ignoring return value of ‘dup’ declared with attribute ‘warn_unused_result’ # 4045 | dup(0); # | ^~~~~~ # 4043| Panic(errno, "Cannot open %s", m); # 4044| dup(0); # 4045|-> dup(0); # 4046| close(D_blankerev.fd); # 4047| if (slave != -1) Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/encoding.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/encoding.c:864:11: warning[core.NullDereference]: Array access (via field 'fontx') results in a null pointer dereference # 862| c = ml->image[i] | (ml->font[i] << 8); # 863| if (p->w_encoding == UTF8) # 864|-> c |= ml->fontx[i] << 16; # 865| if (p->w_encoding != UTF8 && c < 256) # 866| c |= encodings[p->w_encoding].deffont << 8; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/encoding.c:886:47: warning[core.NullDereference]: Array access (via field 'fontx') results in a null pointer dereference # 884| int c2; # 885| i++; # 886|-> c2 = ml->image[i] | (ml->font[i] << 8) | (ml->fontx[i] << 16); # 887| c = recode_char_dw_to_encoding(c, &c2, encoding); # 888| if (encoding == UTF8) Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/encoding.c:922:22: warning[core.NullDereference]: Array access (via field 'fontx') results in a null pointer dereference # 920| } # 921| } # 922|-> ml->fontx[i] = c >> 16 & 255; # 923| } # 924| else Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/encoding.c:1534:20: warning[core.NullDereference]: Array access (via field 'charsets') results in a null pointer dereference # 1532| { # 1533| p->w_gr = 2; # 1534|-> p->w_FontE = encodings[encoding].charsets[1]; # 1535| } # 1536| else Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/fileio.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-457): screen-4.9.1-build/screen-4.9.1/fileio.c: scope_hint: In function ‘CatExtra’ screen-4.9.1-build/screen-4.9.1/fileio.c:77:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘cp’ screen-4.9.1-build/screen-4.9.1/screen.h:150: included_from: Included from here. screen-4.9.1-build/screen-4.9.1/fileio.c:39: included_from: Included from here. screen-4.9.1-build/screen-4.9.1/display.h:212:25: note: in expansion of macro ‘DISPLAY’ screen-4.9.1-build/screen-4.9.1/fileio.c:169:34: note: in expansion of macro ‘D_termname’ # 75| if ((cp = realloc(str2, (unsigned)len1 + len2 + add_colon + 1)) == NULL) # 76| Panic(0, "%s", strnomem); # 77|-> bcopy(cp, cp + len1 + add_colon, len2 + 1); # 78| } else { # 79| if ((cp = malloc((unsigned)len1 + add_colon + 1)) == NULL) Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/fileio.c: scope_hint: In function ‘WriteFile’ screen-4.9.1-build/screen-4.9.1/fileio.c:431:49: warning[-Wunused-result]: ignoring return value of ‘ftruncate’ declared with attribute ‘warn_unused_result’ # 431 | ftruncate(fd, 0); # | ^~~~~~~~~~~~~~~~ # 429| if ((fd = open(fn, O_WRONLY, 0666)) >= 0) { # 430| if (fstat(fd, &stb2) == 0 && stb.st_dev == stb2.st_dev && stb.st_ino == stb2.st_ino) # 431|-> ftruncate(fd, 0); # 432| else { # 433| close(fd); Error: GCC_ANALYZER_WARNING (CWE-775): screen-4.9.1-build/screen-4.9.1/fileio.c: scope_hint: In function ‘printpipe’ screen-4.9.1-build/screen-4.9.1/fileio.c:709:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘pi[0]’ # 707| if (pipe(pi)) { # 708| WMsg(p, errno, "printing pipe"); # 709|-> return -1; # 710| } # 711| switch (fork()) { Error: GCC_ANALYZER_WARNING (CWE-775): screen-4.9.1-build/screen-4.9.1/fileio.c:709:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘pi[1]’ # 707| if (pipe(pi)) { # 708| WMsg(p, errno, "printing pipe"); # 709|-> return -1; # 710| } # 711| switch (fork()) { Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/fileio.c: scope_hint: In function ‘printpipe’ screen-4.9.1-build/screen-4.9.1/fileio.c:724:17: warning[-Wunused-result]: ignoring return value of ‘dup’ declared with attribute ‘warn_unused_result’ # 724 | dup(pi[0]); # | ^~~~~~~~~~ # 722| #endif # 723| close(0); # 724|-> dup(pi[0]); # 725| closeallfiles(0); # 726| if (setgid(real_gid) || setuid(real_uid)) Error: GCC_ANALYZER_WARNING (CWE-775): screen-4.9.1-build/screen-4.9.1/fileio.c:750:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘pi[0]’ # 748| if (pipe(pi)) { # 749| Msg(errno, "pipe"); # 750|-> return -1; # 751| } # 752| Error: GCC_ANALYZER_WARNING (CWE-775): screen-4.9.1-build/screen-4.9.1/fileio.c: scope_hint: In function ‘readpipe’ screen-4.9.1-build/screen-4.9.1/fileio.c:750:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘pi[1]’ # 748| if (pipe(pi)) { # 749| Msg(errno, "pipe"); # 750|-> return -1; # 751| } # 752| Error: GCC_ANALYZER_WARNING (CWE-775): screen-4.9.1-build/screen-4.9.1/fileio.c:765:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup(pi[1])’ # 763| #endif # 764| close(1); # 765|-> if (dup(pi[1]) != 1) { # 766| close(pi[1]); # 767| Panic(0, "dup"); Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/help.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/help.c:330:15: warning[deadcode.DeadStores]: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' # 328| else if (helpdata->grow-2-helpdata->numrows >= helpdata->numskip # 329| && helpdata->grow-2-helpdata->numrows-helpdata->numskip < helpdata->command_bindings) { # 330|-> while ((n = ktabp[helpdata->command_search].nr) == RC_ILLEGAL || ktabp[helpdata->command_search].args == noargs) { # 331| if (++helpdata->command_search >= 256 + KMAP_KEYS) # 332| return -1; Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/input.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-688): screen-4.9.1-build/screen-4.9.1/input.c: scope_hint: In function ‘InpProcess’ screen-4.9.1-build/screen-4.9.1/input.c:433:19: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘store’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null # 431| { # 432| store = malloc(sizeof(struct inpline)); # 433|-> memcpy(store, &inpdata->inp, sizeof(struct inpline)); # 434| } # 435| store->next = &inphist; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/input.c:517:3: warning[deadcode.DeadStores]: Value stored to 's' is never read # 515| v -= l; # 516| } # 517|-> s = r; # 518| r = flayer->l_width; # 519| if (!isblank && v > 0 && q < r) Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/input.c:525:7: warning[deadcode.DeadStores]: Value stored to 'q' is never read # 523| l = r - q; # 524| LClearArea(flayer, q, y, q + l - 1, y, 0, 0); # 525|-> q += l; # 526| } # 527| } Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/layer.c:1062:7: warning[core.NullDereference]: Access to field 'l_layfn' results in a dereference of a null pointer (loaded from variable 'flayer') # 1060| # 1061| flayer = oldlay->l_next; # 1062|-> if (flayer->l_layfn == &WinLf) { # 1063| if (oldlay->l_blocking) { # 1064| ASSERT(p->w_blocked > 0); Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/layout.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/list_generic.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/list_generic.c:290:21: warning[deadcode.DeadStores]: Value stored to 'r' during its initialization is never read # 288| { # 289| int y = flayer->l_mouseevent.buffer[2]; # 290|-> struct ListRow *r = ldata->top; # 291| for (r = ldata->top; r && r->y != -1 && r->y != y; r = r->next) # 292| ; Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/list_generic.c: scope_hint: In function ‘glist_add_row’ screen-4.9.1-build/screen-4.9.1/list_generic.c:407:11: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘r’ # 405| { # 406| struct ListRow *r = calloc(1, sizeof(struct ListRow)); # 407|-> r->data = data; # 408| # 409| if (after) Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/list_window.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/list_window.c:316:8: warning[core.NullDereference]: Access to field 'd_fore' results in a dereference of a null pointer (loaded from variable 'display') # 314| glist_abort(); # 315| display = cd; # 316|-> if (D_fore != win) # 317| SwitchWindow(win->w_number); # 318| } Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/loadav.c: scope_hint: In function ‘GetLoadav’ screen-4.9.1-build/screen-4.9.1/loadav.c:89:3: warning[-Wunused-result]: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ # 89 | fgets(buf, sizeof(buf), fp); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ # 87| return 0; # 88| *buf = 0; # 89|-> fgets(buf, sizeof(buf), fp); # 90| fclose(fp); # 91| /* can't use fscanf because the decimal point symbol depends on Error: GCC_ANALYZER_WARNING (CWE-126): screen-4.9.1-build/screen-4.9.1/loadav.c: scope_hint: In function ‘AddLoadav’ screen-4.9.1-build/screen-4.9.1/loadav.c:391:7: warning[-Wanalyzer-out-of-bounds]: buffer over-read screen-4.9.1-build/screen-4.9.1/loadav.c:391:7: note: read of 1 byte from after the end of ‘" %2.2f"’ screen-4.9.1-build/screen-4.9.1/loadav.c:391:7: note: valid subscripts for ‘" %2.2f"’ are ‘[0]’ to ‘[6]’ # └───────────────────────────────────────────────────────────┘ # ^ ^ ^ ^ ^ ^ ^ screen-4.9.1-build/screen-4.9.1/os.h:30: included_from: Included from here. screen-4.9.1-build/screen-4.9.1/screen.h:30: included_from: Included from here. screen-4.9.1-build/screen-4.9.1/loadav.c:51: included_from: Included from here. /usr/include/stdio.h:365:12: note: parameter 2 of ‘sprintf’ marked as a format string via ‘format’ attribute /usr/include/stdio.h:365:12: note: argument 2 of ‘sprintf’ must be a pointer to a null-terminated string # 389| for (i = 0; i < j; i++) # 390| { # 391|-> sprintf(p, " %2.2f" + !i, FIX_TO_DBL(loadav[i])); # 392| p += strlen(p); # 393| } Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/logfile.c:49:17: warning[core.UndefinedBinaryOperatorResult]: The right operand of '>' is a garbage value # 47| if (fstat(fileno(l->fp), &o) < 0) /* get trouble later */ # 48| return; # 49|-> if (o.st_size > s->st_size) { /* aha, appended text */ # 50| s->st_size = o.st_size; /* this should have changed */ # 51| s->st_mtime = o.st_mtime; /* only size and mtime */ Error: GCC_ANALYZER_WARNING (CWE-457): screen-4.9.1-build/screen-4.9.1/logfile.c: scope_hint: In function ‘changed_logfile’ screen-4.9.1-build/screen-4.9.1/logfile.c:49:20: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*s.st_size’ # 47| if (fstat(fileno(l->fp), &o) < 0) /* get trouble later */ # 48| return; # 49|-> if (o.st_size > s->st_size) { /* aha, appended text */ # 50| s->st_size = o.st_size; /* this should have changed */ # 51| s->st_mtime = o.st_mtime; /* only size and mtime */ Error: GCC_ANALYZER_WARNING (CWE-775): screen-4.9.1-build/screen-4.9.1/logfile.c: scope_hint: In function ‘logfile_reopen’ screen-4.9.1-build/screen-4.9.1/logfile.c:68:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘lf_move_fd(open(name, 1089, 438), wantfd)’ # 66| if (fd == need_fd) # 67| return fd; # 68|-> if (fd >=0 && fd < need_fd) # 69| r = lf_move_fd(dup(fd), need_fd); # 70| close(fd); Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/mark.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/mark.c:724:4: warning[deadcode.DeadStores]: Value stored to 'rep_cnt' is never read # 722| if (rep_cnt == 0) # 723| rep_cnt = 1; # 724|-> rep_cnt = MarkScrollUpDisplay(rep_cnt); # 725| if (cy < D2W(0)) # 726| revto(cx, D2W(0)); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/mark.c:733:4: warning[deadcode.DeadStores]: Value stored to 'rep_cnt' is never read # 731| if (rep_cnt == 0) # 732| rep_cnt = 1; # 733|-> rep_cnt = MarkScrollDownDisplay(rep_cnt); # 734| if (cy > D2W(fore->w_height - 1)) # 735| revto(cx, D2W(fore->w_height - 1)); Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/process.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:1275:57: warning[core.NullDereference]: Access to field 'd_obufmax' results in a dereference of a null pointer (loaded from variable 'display') # 1273| case RC_OBUFLIMIT: # 1274| if (*args == 0) # 1275|-> OutputMsg(0, "Limit is %d, current buffer size is %d", D_obufmax, D_obuflen); # 1276| else if (ParseNum(act, &D_obufmax) == 0 && msgok) # 1277| OutputMsg(0, "Limit set to %d", D_obufmax); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:1496:11: warning[core.NullDereference]: Access to field 'd_user' results in a dereference of a null pointer (loaded from variable 'display') # 1494| case RC_WALL: # 1495| #ifdef MULTIUSER # 1496|-> s = D_user->u_name; # 1497| #else # 1498| s = D_usertty; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:1642:9: warning[core.UndefinedBinaryOperatorResult]: The left operand of '<' is a garbage value # 1640| display = NULL; # 1641| fore = NULL; # 1642|-> if (i < 0) # 1643| OutputMsg(0, "%s: at '%s': no such window.\n", rc_name, args[0]); # 1644| break; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:1880:8: warning[core.NullDereference]: Access to field 'd_ESCseen' results in a dereference of a null pointer (loaded from variable 'display') # 1878| } # 1879| } # 1880|-> if (D_ESCseen != ktab || ktabp != ktab) # 1881| { # 1882| if (D_ESCseen != ktabp) Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:2124:11: warning[core.NullDereference]: Access to field 'd_status_lastmsg' results in a dereference of a null pointer (loaded from variable 'display') # 2122| break; # 2123| case RC_LASTMSG: # 2124|-> if (D_status_lastmsg) # 2125| OutputMsg(0, "%s", D_status_lastmsg); # 2126| break; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:2190:25: warning[core.NullDereference]: Access to field 'd_user' results in a dereference of a null pointer (loaded from variable 'display') # 2188| * but he may never aquire the lock himself without write permission # 2189| */ # 2190|-> if (!AclCheckPermWin(D_user, ACL_WRITE, fore)) # 2191| fore->w_wlockuser = D_user; # 2192| } Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:2787:12: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 2785| break; # 2786| case RC_DEFLOGIN: # 2787|-> if (!strcmp(*args, "always")) # 2788| nwin_default.lflag |= 2; # 2789| else if (!strcmp(*args, "attached")) Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:2842:65: warning[core.NullDereference]: Access to field 'd_mousetrack' results in a dereference of a null pointer (loaded from variable 'display') # 2840| if (!args[0]) # 2841| { # 2842|-> OutputMsg(0, "Mouse tracking for this display is turned %s", D_mousetrack ? "on" : "off"); # 2843| } # 2844| else if (ParseOnOff(act, &n) == 0) Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:2846:17: warning[core.NullDereference]: Access to field 'd_mousetrack' results in a dereference of a null pointer (loaded from variable 'display') # 2844| else if (ParseOnOff(act, &n) == 0) # 2845| { # 2846|-> D_mousetrack = n == 0 ? 0 : 1000; # 2847| if (D_fore) # 2848| MouseMode(D_fore->w_mouse); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:3236:7: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 3234| break; # 3235| case RC_UNSETENV: # 3236|-> unsetenv(*args); # 3237| MakeNewEnv(); # 3238| break; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:3575:17: warning[core.NullDereference]: Access to field 'd_dontmap' results in a dereference of a null pointer (loaded from variable 'display') # 3573| break; # 3574| case RC_MAPNOTNEXT: # 3575|-> D_dontmap = 1; # 3576| break; # 3577| case RC_MAPDEFAULT: Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:3578:20: warning[core.NullDereference]: Access to field 'd_mapdefault' results in a dereference of a null pointer (loaded from variable 'display') # 3576| break; # 3577| case RC_MAPDEFAULT: # 3578|-> D_mapdefault = 1; # 3579| break; # 3580| #endif Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:3678:11: warning[core.NullDereference]: Access to field 'd_nonblock' results in a dereference of a null pointer (loaded from variable 'display') # 3676| #ifdef MULTI # 3677| case RC_NONBLOCK: # 3678|-> i = D_nonblock >= 0; # 3679| if (*args && ((args[0][0] >= '0' && args[0][0] <= '9') || args[0][0] == '.')) # 3680| { Error: COMPILER_WARNING (CWE-483): screen-4.9.1-build/screen-4.9.1/process.c: scope_hint: In function ‘DoAction’ screen-4.9.1-build/screen-4.9.1/process.c:3857:11: warning[-Wmisleading-indentation]: this ‘else’ clause does not guard... # 3857 | else # | ^~~~ screen-4.9.1-build/screen-4.9.1/process.c:3859:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’ # 3859 | break; # | ^~~~~ # 3855| if (printcmd) # 3856| OutputMsg(0, "using '%s' as print command", printcmd); # 3857|-> else # 3858| OutputMsg(0, "using termcap entries for printing"); # 3859| break; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4081:17: warning[core.NullDereference]: Access to field 'd_fore' results in a dereference of a null pointer (loaded from variable 'display') # 4079| } # 4080| else if (!args[1]) # 4081|-> InputSu(D_fore, &D_user, args[0]); # 4082| else if (!args[2]) # 4083| s = DoSu(&D_user, args[0], args[1], "\377"); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4107:26: warning[core.NullDereference]: Access to field 'd_forecv' results in a dereference of a null pointer (loaded from variable 'display') # 4105| break; # 4106| case RC_FIT: # 4107|-> D_forecv->c_xoff = D_forecv->c_xs; # 4108| D_forecv->c_yoff = D_forecv->c_ys; # 4109| RethinkViewportOffsets(D_forecv); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4118:9: warning[core.NullDereference]: Access to field 'd_forecv' results in a dereference of a null pointer (loaded from variable 'display') # 4116| struct canvas *cv = 0; # 4117| if (!*args || !strcmp(*args, "next")) # 4118|-> cv = D_forecv->c_next ? D_forecv->c_next : D_cvlist; # 4119| else if (!strcmp(*args, "prev")) # 4120| { Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4121:16: warning[core.NullDereference]: Access to field 'd_cvlist' results in a dereference of a null pointer (loaded from variable 'display') # 4119| else if (!strcmp(*args, "prev")) # 4120| { # 4121|-> for (cv = D_cvlist; cv->c_next && cv->c_next != D_forecv; cv = cv->c_next) # 4122| ; # 4123| } Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4125:9: warning[core.NullDereference]: Access to field 'd_cvlist' results in a dereference of a null pointer (loaded from variable 'display') # 4123| } # 4124| else if (!strcmp(*args, "top")) # 4125|-> cv = D_cvlist; # 4126| else if (!strcmp(*args, "bottom")) # 4127| { Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4128:16: warning[core.NullDereference]: Access to field 'd_cvlist' results in a dereference of a null pointer (loaded from variable 'display') # 4126| else if (!strcmp(*args, "bottom")) # 4127| { # 4128|-> for (cv = D_cvlist; cv->c_next; cv = cv->c_next) # 4129| ; # 4130| } Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4132:20: warning[core.NullDereference]: Access to field 'd_forecv' results in a dereference of a null pointer (loaded from variable 'display') # 4130| } # 4131| else if (!strcmp(*args, "up")) # 4132|-> cv = FindCanvas(D_forecv->c_xs, D_forecv->c_ys - 1); # 4133| else if (!strcmp(*args, "down")) # 4134| cv = FindCanvas(D_forecv->c_xs, D_forecv->c_ye + 2); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4134:20: warning[core.NullDereference]: Access to field 'd_forecv' results in a dereference of a null pointer (loaded from variable 'display') # 4132| cv = FindCanvas(D_forecv->c_xs, D_forecv->c_ys - 1); # 4133| else if (!strcmp(*args, "down")) # 4134|-> cv = FindCanvas(D_forecv->c_xs, D_forecv->c_ye + 2); # 4135| else if (!strcmp(*args, "left")) # 4136| cv = FindCanvas(D_forecv->c_xs - 1, D_forecv->c_ys); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4136:20: warning[core.NullDereference]: Access to field 'd_forecv' results in a dereference of a null pointer (loaded from variable 'display') # 4134| cv = FindCanvas(D_forecv->c_xs, D_forecv->c_ye + 2); # 4135| else if (!strcmp(*args, "left")) # 4136|-> cv = FindCanvas(D_forecv->c_xs - 1, D_forecv->c_ys); # 4137| else if (!strcmp(*args, "right")) # 4138| cv = FindCanvas(D_forecv->c_xe + 1, D_forecv->c_ys); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4138:20: warning[core.NullDereference]: Access to field 'd_forecv' results in a dereference of a null pointer (loaded from variable 'display') # 4136| cv = FindCanvas(D_forecv->c_xs - 1, D_forecv->c_ys); # 4137| else if (!strcmp(*args, "right")) # 4138|-> cv = FindCanvas(D_forecv->c_xe + 1, D_forecv->c_ys); # 4139| else # 4140| { Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4149:11: warning[core.NullDereference]: Access to field 'd_forecv' results in a dereference of a null pointer (loaded from variable 'display') # 4147| case RC_RESIZE: # 4148| i = 0; # 4149|-> if (D_forecv->c_slorient == SLICE_UNKN) # 4150| { # 4151| OutputMsg(0, "resize: need more than one region"); Error: CPPCHECK_WARNING (CWE-401): screen-4.9.1-build/screen-4.9.1/process.c:4215: error[memleakOnRealloc]: Common realloc mistake: 'wtab' nulled but not freed upon failure # 4213| if (!windows) # 4214| { # 4215|-> wtab = realloc(wtab, n * sizeof(struct win *)); # 4216| bzero(wtab, n * sizeof(struct win *)); # 4217| } Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4658:7: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'cmd') # 4656| * same, and ignore all messages on either flag. If we wanted to do otherwise, we would # 4657| * need to change the definition of 'OutputMsg' slightly. */ # 4658|-> if (*cmd == '@') /* Suppress error */ # 4659| { # 4660| act.quiet |= 0x01; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4695:15: warning[core.NullDereference]: Access to field 'nr' results in a dereference of a null pointer (loaded from variable 'act') # 4693| if (argc == 0) # 4694| { # 4695|-> act->nr = nr; # 4696| act->args = noargs; # 4697| act->argl = 0; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4704:11: warning[core.NullDereference]: Access to field 'nr' results in a dereference of a null pointer (loaded from variable 'act') # 4702| if ((lp = (int *)malloc((unsigned)(argc) * sizeof(int))) == 0) # 4703| Panic(0, "%s", strnomem); # 4704|-> act->nr = nr; # 4705| act->args = pp; # 4706| act->argl = lp; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4724:27: warning[unix.MallocSizeof]: Result of 'malloc' is converted to a pointer of type 'char *', which is incompatible with sizeof operand type 'char **' # 4722| while (args[argc]) # 4723| argc++; # 4724|-> if ((pp = ap = (char **)malloc((unsigned)(argc + 1) * sizeof(char **))) == 0) # 4725| Panic(0, "%s", strnomem); # 4726| while (argc--) Error: CPPCHECK_WARNING (CWE-457): screen-4.9.1-build/screen-4.9.1/process.c:4885: warning[uninitvar]: Uninitialized variable: v # 4883| } # 4884| *pe = op; # 4885|-> vl = v ? strlen(v) : 0; # 4886| if (vl) # 4887| { Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:4995:11: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 4993| if (args[1] == 0) # 4994| { # 4995|-> if (strcmp(args[0], "on") == 0) # 4996| num = 1; # 4997| else if (strcmp(args[0], "off") == 0) Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:5005:8: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'var') # 5003| return -1; # 5004| } # 5005|-> *var = num; # 5006| return 0; # 5007| } Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:5198:7: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'p') # 5196| int c; # 5197| # 5198|-> if (*p == 0) # 5199| { # 5200| Msg(0, "%s: %s: empty argument.", rc_name, comms[act->nr].name); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:5432:9: warning[core.NullDereference]: Access to field 'w_next' results in a dereference of a null pointer (loaded from variable 'p') # 5430| break; # 5431| ASSERT(p); # 5432|-> *pp = p->w_next; # 5433| wi->w_inlen = 0; # 5434| wtab[wi->w_number] = 0; Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/process.c: scope_hint: In function ‘KillWindow’ screen-4.9.1-build/screen-4.9.1/process.c:5432:10: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘p’ screen-4.9.1-build/screen-4.9.1/screen.h:150: included_from: Included from here. screen-4.9.1-build/screen-4.9.1/process.c:52: included_from: Included from here. screen-4.9.1-build/screen-4.9.1/display.h:276:25: note: in expansion of macro ‘DISPLAY’ screen-4.9.1-build/screen-4.9.1/process.c:776:34: note: in expansion of macro ‘D_seql’ # 5430| break; # 5431| ASSERT(p); # 5432|-> *pp = p->w_next; # 5433| wi->w_inlen = 0; # 5434| wtab[wi->w_number] = 0; Error: CPPCHECK_WARNING (CWE-457): screen-4.9.1-build/screen-4.9.1/process.c:5527: warning[uninitvar]: Uninitialized variable: ss # 5525| { # 5526| *s = 0; # 5527|-> return ss; # 5528| } # 5529| for (pp = ((flags & 4) && where >= 0) ? wtab + where + 1: wtab; pp < wtab + maxwin; pp++) Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:5728:43: warning[core.NullDereference]: Access to field 'd_x' results in a dereference of a null pointer (loaded from variable 'display') # 5726| if (wp == 0) # 5727| { # 5728|-> Msg(0, "(%d,%d)/(%d,%d) no window", D_x + 1, D_y + 1, D_width, D_height); # 5729| return; # 5730| } Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:5861:7: warning[deadcode.DeadStores]: Value stored to 'p' is never read # 5859| { # 5860| strcpy(p, " iso2022"); # 5861|-> p += strlen(p); # 5862| } # 5863| else if (D_CS0 && *D_CS0) Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:5866:7: warning[deadcode.DeadStores]: Value stored to 'p' is never read # 5864| { # 5865| strcpy(p, " altchar"); # 5866|-> p += strlen(p); # 5867| } # 5868| #endif Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:6187:16: warning[core.UndefinedBinaryOperatorResult]: The left operand of '!=' is a garbage value # 6185| if (av && *av && IsNumColon(*av, 10, buf, sizeof(buf))) # 6186| { # 6187|-> if (*buf != '\0') # 6188| nwin.aka = buf; # 6189| num = atoi(*av); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/process.c:6235:13: warning[core.NullDereference]: Dereference of null pointer # 6233| while (sl) # 6234| { # 6235|-> key = *(unsigned char *)s++; # 6236| if (*s != '=' || sl < 3) # 6237| return -1; Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/process.c: scope_hint: In function ‘pow_detach_fn’ screen-4.9.1-build/screen-4.9.1/process.c:6277:9: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ # 6277 | write(D_userfd, "\007", 1); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~ # 6275| { # 6276| if (display) # 6277|-> write(D_userfd, "\007", 1); # 6278| Msg(0, "Detach aborted."); # 6279| } Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/resize.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/resize.c: scope_hint: In function ‘FreeMline’ screen-4.9.1-build/screen-4.9.1/resize.c:428:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ml’ screen-4.9.1-build/screen-4.9.1/resize.c: scope_hint: In function ‘FreeMline’ screen-4.9.1-build/screen-4.9.1/screen.h:151: included_from: Included from here. screen-4.9.1-build/screen-4.9.1/resize.c:42: included_from: Included from here. screen-4.9.1-build/screen-4.9.1/resize.c:718:20: note: in expansion of macro ‘w_width’ screen-4.9.1-build/screen-4.9.1/resize.c:752:10: note: in expansion of macro ‘w_width’ # 426| struct mline *ml; # 427| { # 428|-> if (ml->image) # 429| free(ml->image); # 430| if (ml->attr && ml->attr != null) Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/resize.c: scope_hint: In function ‘AllocMline’ screen-4.9.1-build/screen-4.9.1/resize.c:454:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ml’ screen-4.9.1-build/screen-4.9.1/resize.c: scope_hint: In function ‘AllocMline’ screen-4.9.1-build/screen-4.9.1/resize.c:718:20: note: in expansion of macro ‘w_width’ screen-4.9.1-build/screen-4.9.1/resize.c:752:10: note: in expansion of macro ‘w_width’ # 452| int w; # 453| { # 454|-> ml->image = malloc(w); # 455| ml->attr = null; # 456| #ifdef FONT Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/resize.c: scope_hint: In function ‘ChangeWindowSize’ screen-4.9.1-build/screen-4.9.1/resize.c:815:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘mlf’ screen-4.9.1-build/screen-4.9.1/resize.c: scope_hint: In function ‘ChangeWindowSize’ screen-4.9.1-build/screen-4.9.1/resize.c:718:20: note: in expansion of macro ‘w_width’ screen-4.9.1-build/screen-4.9.1/resize.c:752:10: note: in expansion of macro ‘w_width’ screen-4.9.1-build/screen-4.9.1/resize.c:801:14: note: in expansion of macro ‘w_width’ # 813| /* calculate lenght */ # 814| for (l = p->w_width - 1; l > 0; l--) # 815|-> if (mlf->image[l] != ' ' || mlf->attr[l]) # 816| break; # 817| if (fy == p->w_y + p->w_histheight && l < p->w_x) Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/resize.c:837:18: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘mlt’ screen-4.9.1-build/screen-4.9.1/resize.c: scope_hint: In function ‘ChangeWindowSize’ screen-4.9.1-build/screen-4.9.1/resize.c:718:20: note: in expansion of macro ‘w_width’ screen-4.9.1-build/screen-4.9.1/resize.c:752:10: note: in expansion of macro ‘w_width’ screen-4.9.1-build/screen-4.9.1/resize.c:801:14: note: in expansion of macro ‘w_width’ screen-4.9.1-build/screen-4.9.1/resize.c:817:20: note: in expansion of macro ‘w_y’ # 835| { # 836| lx = lt > lf ? lf : lt; # 837|-> if (mlt->image == 0) # 838| { # 839| if (AllocMline(mlt, wi + 1)) Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/sched.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/sched.c:74:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘timeoutev’ screen-4.9.1-build/screen-4.9.1/sched.c: scope_hint: In function ‘sched’ /usr/include/sys/select.h:30: included_from: Included from here. /usr/include/sys/types.h:179: included_from: Included from here. screen-4.9.1-build/screen-4.9.1/sched.c:29: included_from: Included from here. # 72| struct event *evp, **evpp; # 73| debug3("Deq event fd %d type %d queued %d\n", ev -> fd, ev -> type, ev -> queued); # 74|-> if (!ev->queued) # 75| return; # 76| evpp = &evs; Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:786:18: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'SockMatch') # 784| exit_with_usage(myname, "Session-name is too long (max length is 80 symbols)", NULL); # 785| } # 786|-> if (!*SockMatch) # 787| exit_with_usage(myname, "Empty session-name?", NULL); # 788| break; Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c:987:5: warning[-Wunused-result]: ignoring return value of ‘setgid’ declared with attribute ‘warn_unused_result’ # 987 | setgid(real_gid); \ # | ^~~~~~~~~~~~~~~~ screen-4.9.1-build/screen-4.9.1/screen.c:1184:5: note: in expansion of macro ‘SET_GUID’ # 1184 | SET_GUID(); # | ^~~~~~~~ # 985| #define SET_GUID() do \ # 986| { \ # 987|-> setgid(real_gid); \ # 988| setuid(real_uid); \ # 989| eff_uid = real_uid; \ Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c:988:5: warning[-Wunused-result]: ignoring return value of ‘setuid’ declared with attribute ‘warn_unused_result’ # 988 | setuid(real_uid); \ # | ^~~~~~~~~~~~~~~~ screen-4.9.1-build/screen-4.9.1/screen.c:1184:5: note: in expansion of macro ‘SET_GUID’ # 1184 | SET_GUID(); # | ^~~~~~~~ # 986| { \ # 987| setgid(real_gid); \ # 988|-> setuid(real_uid); \ # 989| eff_uid = real_uid; \ # 990| eff_gid = real_gid; \ Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:1013:32: warning[core.UndefinedBinaryOperatorResult]: The left operand of '&' is a garbage value # 1011| SetTtyname(true, &st); # 1012| #ifdef MULTIUSER # 1013|-> tty_mode = (int)st.st_mode & 0777; # 1014| #endif # 1015| Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c: scope_hint: In function ‘main’ screen-4.9.1-build/screen-4.9.1/screen.c:1124:16: warning[-Wunused-result]: ignoring return value of ‘chown’ declared with attribute ‘warn_unused_result’ # 1124 | (void) chown(SockPath, real_uid, real_gid); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 1122| if (mkdir(SockPath, 0700) == -1 && errno != EEXIST) # 1123| Panic(errno, "Cannot make directory '%s'", SockPath); # 1124|-> (void) chown(SockPath, real_uid, real_gid); # 1125| } # 1126| } Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:1184:5: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setgid' is not checked. If an error occurs in 'setgid', the following code may execute with unexpected privileges # 1182| #endif # 1183| # 1184|-> SET_GUID(); # 1185| i = FindSocket((int *)NULL, &fo, &oth, SockMatch, &sock); # 1186| if (quietflag) { Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:1184:5: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges # 1182| #endif # 1183| # 1184|-> SET_GUID(); # 1185| i = FindSocket((int *)NULL, &fo, &oth, SockMatch, &sock); # 1186| if (quietflag) { Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:1217:5: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setgid' is not checked. If an error occurs in 'setgid', the following code may execute with unexpected privileges # 1215| --av; # 1216| } # 1217|-> SET_GUID(); # 1218| SendCmdMessage(sty, SockMatch, av, queryflag >= 0); # 1219| exit(0); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:1217:5: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges # 1215| --av; # 1216| } # 1217|-> SET_GUID(); # 1218| SendCmdMessage(sty, SockMatch, av, queryflag >= 0); # 1219| exit(0); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:1244:5: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setgid' is not checked. If an error occurs in 'setgid', the following code may execute with unexpected privileges # 1242| /* attach_tty is not mandatory */ # 1243| SetTtyname(false, &st); # 1244|-> SET_GUID(); # 1245| nwin_options.args = av; # 1246| SendCreateMsg(sty, &nwin); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:1244:5: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges # 1242| /* attach_tty is not mandatory */ # 1243| SetTtyname(false, &st); # 1244|-> SET_GUID(); # 1245| nwin_options.args = av; # 1246| SendCreateMsg(sty, &nwin); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:1278:5: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setgid' is not checked. If an error occurs in 'setgid', the following code may execute with unexpected privileges # 1276| #endif # 1277| sprintf(SockPath + strlen(SockPath), "/%s", socknamebuf); # 1278|-> SET_GUID(); # 1279| Attacher(); # 1280| /* NOTREACHED */ Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:1278:5: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges # 1276| #endif # 1277| sprintf(SockPath + strlen(SockPath), "/%s", socknamebuf); # 1278|-> SET_GUID(); # 1279| Attacher(); # 1280| /* NOTREACHED */ Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:1291:14: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 1289| DefaultMetaEsc = 'a'; # 1290| # 1291|-> ap = av0 + strlen(av0) - 1; # 1292| while (ap >= av0) { # 1293| if (!strncmp("screen", ap, 6)) { Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c:1326:3: warning[-Wunused-result]: ignoring return value of ‘freopen’ declared with attribute ‘warn_unused_result’ # 1326 | freopen("/dev/null", "r", stdin); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 1324| else # 1325| n = -1; # 1326|-> freopen("/dev/null", "r", stdin); # 1327| freopen("/dev/null", "w", stdout); # 1328| Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c:1327:3: warning[-Wunused-result]: ignoring return value of ‘freopen’ declared with attribute ‘warn_unused_result’ # 1327 | freopen("/dev/null", "w", stdout); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 1325| n = -1; # 1326| freopen("/dev/null", "r", stdin); # 1327|-> freopen("/dev/null", "w", stdout); # 1328| # 1329| #ifdef DEBUG Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c:1332:3: warning[-Wunused-result]: ignoring return value of ‘freopen’ declared with attribute ‘warn_unused_result’ # 1332 | freopen("/dev/null", "w", stderr); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 1330| if (dfp != stderr) # 1331| #endif # 1332|-> freopen("/dev/null", "w", stderr); # 1333| debug("-- screen.back debug started\n"); # 1334| Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c: scope_hint: In function ‘CoreDump’ screen-4.9.1-build/screen-4.9.1/screen.c:1670:3: warning[-Wunused-result]: ignoring return value of ‘setgid’ declared with attribute ‘warn_unused_result’ # 1670 | setgid(getgid()); # | ^~~~~~~~~~~~~~~~ # 1668| signal(sigsig, SIG_IGN); # 1669| #endif # 1670|-> setgid(getgid()); # 1671| setuid(getuid()); # 1672| unlink("core"); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:1670:3: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setgid' is not checked. If an error occurs in 'setgid', the following code may execute with unexpected privileges # 1668| signal(sigsig, SIG_IGN); # 1669| #endif # 1670|-> setgid(getgid()); # 1671| setuid(getuid()); # 1672| unlink("core"); Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c:1671:3: warning[-Wunused-result]: ignoring return value of ‘setuid’ declared with attribute ‘warn_unused_result’ # 1671 | setuid(getuid()); # | ^~~~~~~~~~~~~~~~ # 1669| #endif # 1670| setgid(getgid()); # 1671|-> setuid(getuid()); # 1672| unlink("core"); # 1673| Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:1671:3: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges # 1669| #endif # 1670| setgid(getgid()); # 1671|-> setuid(getuid()); # 1672| unlink("core"); # 1673| Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c:1685:7: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ # 1685 | write(disp->d_userfd, buf, strlen(buf)); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 1683| fcntl(disp->d_userfd, F_SETFL, 0); # 1684| SetTTY(disp->d_userfd, &D_OldMode); # 1685|-> write(disp->d_userfd, buf, strlen(buf)); # 1686| Kill(disp->d_userpid, SIG_BYE); # 1687| } Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c: scope_hint: In function ‘eexit’ screen-4.9.1-build/screen-4.9.1/screen.c:1863:5: warning[-Wunused-result]: ignoring return value of ‘setgid’ declared with attribute ‘warn_unused_result’ # 1863 | setgid(real_gid); # | ^~~~~~~~~~~~~~~~ # 1861| if (ServerSocket != -1) { # 1862| debug1("we unlink(%s)\n", SockPath); # 1863|-> setgid(real_gid); # 1864| setuid(real_uid); # 1865| (void) unlink(SockPath); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:1863:5: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setgid' is not checked. If an error occurs in 'setgid', the following code may execute with unexpected privileges # 1861| if (ServerSocket != -1) { # 1862| debug1("we unlink(%s)\n", SockPath); # 1863|-> setgid(real_gid); # 1864| setuid(real_uid); # 1865| (void) unlink(SockPath); Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c:1864:5: warning[-Wunused-result]: ignoring return value of ‘setuid’ declared with attribute ‘warn_unused_result’ # 1864 | setuid(real_uid); # | ^~~~~~~~~~~~~~~~ # 1862| debug1("we unlink(%s)\n", SockPath); # 1863| setgid(real_gid); # 1864|-> setuid(real_uid); # 1865| (void) unlink(SockPath); # 1866| } Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:1864:5: warning[security.insecureAPI.UncheckedReturn]: The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges # 1862| debug1("we unlink(%s)\n", SockPath); # 1863| setgid(real_gid); # 1864|-> setuid(real_uid); # 1865| (void) unlink(SockPath); # 1866| } Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:2054:27: warning[unix.MallocSizeof]: Result of 'malloc' is converted to a pointer of type 'char *', which is incompatible with sizeof operand type 'char **' # 2052| if (NewEnv) # 2053| free((char *)NewEnv); # 2054|-> NewEnv = np = (char **) malloc((unsigned) (op - environ + 7 + 1) * sizeof(char **)); # 2055| if (!NewEnv) # 2056| Panic(0, "%s", strnomem); Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c: scope_hint: In function ‘Msg’ screen-4.9.1-build/screen-4.9.1/screen.c:2130:5: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ # 2130 | write(queryflag, buf, strlen(buf)); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 2128| # 2129| if (queryflag >= 0) # 2130|-> write(queryflag, buf, strlen(buf)); # 2131| } # 2132| Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c: scope_hint: In function ‘Panic’ screen-4.9.1-build/screen-4.9.1/screen.c:2168:7: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ # 2168 | write(D_userfd, buf, strlen(buf)); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 2166| SetTTY(D_userfd, &D_OldMode); # 2167| fcntl(D_userfd, F_SETFL, 0); # 2168|-> write(D_userfd, buf, strlen(buf)); # 2169| write(D_userfd, "\n", 1); # 2170| freetty(); Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c:2169:7: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ # 2169 | write(D_userfd, "\n", 1); # | ^~~~~~~~~~~~~~~~~~~~~~~~ # 2167| fcntl(D_userfd, F_SETFL, 0); # 2168| write(D_userfd, buf, strlen(buf)); # 2169|-> write(D_userfd, "\n", 1); # 2170| freetty(); # 2171| if (D_userpid) Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c: scope_hint: In function ‘QueryMsg’ screen-4.9.1-build/screen-4.9.1/screen.c:2199:3: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ # 2199 | write(queryflag, buf, strlen(buf)); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 2197| # 2198| PROCESS_MESSAGE(buf); # 2199|-> write(queryflag, buf, strlen(buf)); # 2200| } # 2201| Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/screen.c: scope_hint: In function ‘runbacktick’ screen-4.9.1-build/screen-4.9.1/screen.c:2411:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘bt’ screen-4.9.1-build/screen-4.9.1/screen.c: scope_hint: In function ‘runbacktick’ # 2409| # 2410| debug1("runbacktick called for backtick #%d\n", bt->num); # 2411|-> if (bt->tick && (!*tickp || bt->tick < *tickp)) # 2412| *tickp = bt->tick; # 2413| if ((bt->lifespan == 0 && bt->tick == 0) || now < bt->bestbefore) { Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/screen.c:3023:5: warning[deadcode.DeadStores]: Value stored to 'p' is never read # 3021| if (padlen > MAXSTR - 1) # 3022| padlen = MAXSTR - 1; # 3023|-> p = pad_expand(winmsg_buf, p, numpad, padlen); # 3024| } # 3025| if (ev) { Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/screen.c: scope_hint: In function ‘serv_select_fn’ screen-4.9.1-build/screen-4.9.1/screen.c:3165:7: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ # 3165 | write(W_UWP(fore) ? fore->w_pwin->p_ptyfd : fore->w_ptyfd, &ibuf, 1); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 3163| # 3164| #ifdef PSEUDOS # 3165|-> write(W_UWP(fore) ? fore->w_pwin->p_ptyfd : fore->w_ptyfd, &ibuf, 1); # 3166| debug1("Backend wrote interrupt to %d", fore->w_number); # 3167| debug1("%s\n", W_UWP(fore) ? " (pseudowin)" : ""); Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/search.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/socket.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-775): screen-4.9.1-build/screen-4.9.1/socket.c: scope_hint: In function ‘MakeServerFifo’ screen-4.9.1-build/screen-4.9.1/socket.c:438:6: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&SockPath, 2049)’ # 436| #endif # 437| s = open(SockPath, O_WRONLY | O_NONBLOCK); # 438|-> if (s >= 0) # 439| { # 440| debug("huii, my fifo already exists??\n"); Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/socket.c: scope_hint: In function ‘SendErrorMsg’ screen-4.9.1-build/screen-4.9.1/socket.c:757:10: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ # 757 | (void) write(s, (char *) &m, sizeof m); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 755| m.protocol_revision = MSG_REVISION; # 756| debug1("SendErrorMsg(): writing to '%s'\n", SockPath); # 757|-> (void) write(s, (char *) &m, sizeof m); # 758| close(s); # 759| return 0; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/socket.c:903:7: warning[deadcode.DeadStores]: Value stored to 'recvfd' is never read # 901| # 902| i = recvfd; # 903|-> recvfd = -1; # 904| memset(&ttyname_in_ns, 0, sizeof(ttyname_in_ns)); # 905| errno = 0; Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/socket.c: scope_hint: In function ‘CreateTempDisplay’ screen-4.9.1-build/screen-4.9.1/socket.c:961:11: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ # 961 | write(i, "Attaching from inside of screen?\n", 33); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 959| if (display || wi) # 960| { # 961|-> write(i, "Attaching from inside of screen?\n", 33); # 962| close(i); # 963| Kill(pid, SIG_BYE); Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/socket.c:972:15: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ # 972 | write(i, "Access to session denied.\n", 26); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 970| if (*FindUserPtr(user) == 0) # 971| { # 972|-> write(i, "Access to session denied.\n", 26); # 973| close(i); # 974| Kill(pid, SIG_BYE); Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/socket.c:996:7: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ # 996 | write(i, "Could not make display.\n", 24); # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 994| if (MakeDisplay(user, m->m_tty, attach ? m->m.attach.envterm : "", i, pid, &Mode) == 0) # 995| { # 996|-> write(i, "Could not make display.\n", 24); # 997| close(i); # 998| Msg(0, "Attach: could not make display for user %s", user); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/socket.c:1242:21: warning[core.NullDereference]: Access to field 'd_blocked' results in a dereference of a null pointer (loaded from variable 'display') # 1240| case MSG_ERROR: # 1241| { # 1242|-> int blocked=D_blocked; # 1243| if(D_blocked == 4) /* allow error messages while in blanker mode */ # 1244| D_blocked=0; /* likely they're from failed blanker */ Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/teln.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/termcap.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/termcap.c:758:20: warning[deadcode.DeadStores]: Although the value stored to 'j' is used in the enclosing expression, the value is never actually read from 'j' # 756| unsigned char *p, *q; # 757| # 758|-> if (k >= 254 || (j = findseq_ge(seq, k, &p)) != 0) # 759| return -1; # 760| for (q = D_kmaps; q < p; q += 2 * l + 4) Error: GCC_ANALYZER_WARNING (CWE-787): screen-4.9.1-build/screen-4.9.1/termcap.c: scope_hint: In function ‘MakeTermcap’ screen-4.9.1-build/screen-4.9.1/termcap.c:889:11: warning[-Wanalyzer-out-of-bounds]: buffer overflow screen-4.9.1-build/screen-4.9.1/termcap.c:889:11: note: write of 5 bytes to beyond the end of ‘Term’ screen-4.9.1-build/screen-4.9.1/termcap.c:889:11: note: valid subscripts for ‘Term’ are ‘[0]’ to ‘[772]’ # 887| if (!aflag && strlen(screenterm) + strlen(tname) < MAXSTR-1) # 888| { # 889|-> sprintf(p, "%s.%s", screenterm, tname); # 890| if (e_tgetent(buf, p) == 1) # 891| break; Error: GCC_ANALYZER_WARNING (CWE-787): screen-4.9.1-build/screen-4.9.1/termcap.c:896:11: warning[-Wanalyzer-out-of-bounds]: buffer overflow screen-4.9.1-build/screen-4.9.1/termcap.c:896:11: note: write of 5 bytes to beyond the end of ‘Term’ screen-4.9.1-build/screen-4.9.1/termcap.c:896:11: note: valid subscripts for ‘Term’ are ‘[0]’ to ‘[772]’ # 894| if (nwin_default.bce) # 895| { # 896|-> sprintf(p, "%s-bce", screenterm); # 897| if (e_tgetent(buf, p) == 1) # 898| break; Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/tty.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/utmp.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: COMPILER_WARNING (CWE-477): screen-4.9.1-build/screen-4.9.1/utmp.c: scope_hint: In function ‘pututslot’ screen-4.9.1-build/screen-4.9.1/utmp.c:582:9: warning[-Wdeprecated-declarations]: ‘addToUtmp’ is deprecated: better use utempter_add_record instead screen-4.9.1-build/screen-4.9.1/utmp.c:38: included_from: Included from here. /usr/include/utempter.h:44:13: note: declared here # 580| /* sigh, linux hackers made the helper functions void */ # 581| if (SLOT_USED(u)) # 582|-> addToUtmp(wi->w_tty, host, wi->w_ptyfd); # 583| else # 584| removeLineFromUtmp(wi->w_tty, wi->w_ptyfd); Error: COMPILER_WARNING (CWE-477): screen-4.9.1-build/screen-4.9.1/utmp.c:584:9: warning[-Wdeprecated-declarations]: ‘removeLineFromUtmp’ is deprecated: better use utempter_remove_record instead /usr/include/utempter.h:48:13: note: declared here # 582| addToUtmp(wi->w_tty, host, wi->w_ptyfd); # 583| else # 584|-> removeLineFromUtmp(wi->w_tty, wi->w_ptyfd); # 585| /* # 586| * As documented in libutempter: "During execution of the privileged Error: CPPCHECK_WARNING: screen-4.9.1-build/screen-4.9.1/window.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/window.c: scope_hint: In function ‘MakeWindow’ screen-4.9.1-build/screen-4.9.1/window.c:596:11: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pp’ # 594| do # 595| { # 596|-> if (*pp == 0) # 597| break; # 598| if (++pp == wtab + maxwin) Error: GCC_ANALYZER_WARNING (CWE-476): screen-4.9.1-build/screen-4.9.1/window.c:602:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pp’ # 600| } # 601| while (pp != wtab + startat); # 602|-> if (*pp) # 603| { # 604| Msg(0, "No more windows."); Error: CPPCHECK_WARNING (CWE-457): screen-4.9.1-build/screen-4.9.1/window.c:923: warning[uninitvar]: Uninitialized variable: f # 921| # 922| strncpy(p->w_tty, *TtyName ? TtyName : p->w_title, MAXSTR - 1); # 923|-> p->w_ptyfd = f; # 924| p->w_readev.fd = f; # 925| p->w_writeev.fd = f; Error: GCC_ANALYZER_WARNING (CWE-457): screen-4.9.1-build/screen-4.9.1/window.c: scope_hint: In function ‘RemakeWindow’ screen-4.9.1-build/screen-4.9.1/window.c:923:14: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘f’ # 921| # 922| strncpy(p->w_tty, *TtyName ? TtyName : p->w_title, MAXSTR - 1); # 923|-> p->w_ptyfd = f; # 924| p->w_readev.fd = f; # 925| p->w_writeev.fd = f; Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/window.c:923:14: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 921| # 922| strncpy(p->w_tty, *TtyName ? TtyName : p->w_title, MAXSTR - 1); # 923|-> p->w_ptyfd = f; # 924| p->w_readev.fd = f; # 925| p->w_writeev.fd = f; Error: COMPILER_WARNING (CWE-457): screen-4.9.1-build/screen-4.9.1/window.c: scope_hint: In function ‘RemakeWindow’ screen-4.9.1-build/screen-4.9.1/window.c:925:19: warning[-Wmaybe-uninitialized]: ‘f’ may be used uninitialized # 925 | p->w_writeev.fd = f; # | ~~~~~~~~~~~~~~~~^~~ screen-4.9.1-build/screen-4.9.1/window.c:907:14: note: ‘f’ was declared here # 907 | int lflag, f; # | ^ # 923| p->w_ptyfd = f; # 924| p->w_readev.fd = f; # 925|-> p->w_writeev.fd = f; # 926| evenq(&p->w_readev); # 927| evenq(&p->w_writeev); Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/window.c: scope_hint: In function ‘CloseDevice’ screen-4.9.1-build/screen-4.9.1/window.c:983:13: warning[-Wunused-result]: ignoring return value of ‘chown’ declared with attribute ‘warn_unused_result’ # 983 | (void)chown(wp->w_tty, 0, 0); # | ^~~~~~~~~~~~~~~~~~~~~~ # 981| /* pty 4 SALE */ # 982| (void)chmod(wp->w_tty, 0666); # 983|-> (void)chown(wp->w_tty, 0, 0); # 984| } # 985| close(wp->w_ptyfd); Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/window.c: scope_hint: In function ‘ForkWindow’ screen-4.9.1-build/screen-4.9.1/window.c:1297:11: warning[-Wunused-result]: ignoring return value of ‘dup’ declared with attribute ‘warn_unused_result’ # 1297 | dup(slave); # | ^~~~~~~~~~ # 1295| { # 1296| close(0); # 1297|-> dup(slave); # 1298| close(slave); # 1299| closeallfiles(win->w_ptyfd); Error: GCC_ANALYZER_WARNING (CWE-910): screen-4.9.1-build/screen-4.9.1/window.c: scope_hint: In function ‘ForkWindow’ screen-4.9.1-build/screen-4.9.1/window.c:1300:19: warning[-Wanalyzer-fd-use-after-close]: ‘dup’ on closed file descriptor ‘0’ # 1298| close(slave); # 1299| closeallfiles(win->w_ptyfd); # 1300|-> slave = dup(0); # 1301| } # 1302| else Error: GCC_ANALYZER_WARNING (CWE-1341): screen-4.9.1-build/screen-4.9.1/window.c:1318:7: warning[-Wanalyzer-fd-double-close]: double ‘close’ of file descriptor ‘0’ # 1316| #endif # 1317| /* Close the three /dev/null descriptors */ # 1318|-> close(0); # 1319| close(1); # 1320| close(2); Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/window.c:1348:17: warning[-Wunused-result]: ignoring return value of ‘dup’ declared with attribute ‘warn_unused_result’ # 1348 | dup(newfd); # | ^~~~~~~~~~ # 1346| } # 1347| else # 1348|-> dup(newfd); # 1349| } # 1350| else Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/window.c:1352:15: warning[-Wunused-result]: ignoring return value of ‘dup’ declared with attribute ‘warn_unused_result’ # 1352 | dup(win->w_ptyfd); # | ^~~~~~~~~~~~~~~~~ # 1350| else # 1351| { # 1352|-> dup(win->w_ptyfd); # 1353| wfdused = 1; # 1354| } Error: COMPILER_WARNING (CWE-252): screen-4.9.1-build/screen-4.9.1/window.c: scope_hint: In function ‘FreePseudowin’ screen-4.9.1-build/screen-4.9.1/window.c:1704:9: warning[-Wunused-result]: ignoring return value of ‘chown’ declared with attribute ‘warn_unused_result’ # 1704 | (void)chown(pwin->p_tty, 0, 0); # | ^~~~~~~~~~~~~~~~~~~~~~~~ # 1702| /* should be able to use CloseDevice() here */ # 1703| (void)chmod(pwin->p_tty, 0666); # 1704|-> (void)chown(pwin->p_tty, 0, 0); # 1705| if (pwin->p_ptyfd >= 0) # 1706| close(pwin->p_ptyfd); Error: CLANG_WARNING: screen-4.9.1-build/screen-4.9.1/window.c:2154:33: warning[core.UndefinedBinaryOperatorResult]: The right operand of '==' is a garbage value due to array index out of bounds # 2152| continue; # 2153| } # 2154|-> if (p->w_zauto > 5 || *b2 == "**\030B00"[p->w_zauto] || (p->w_zauto == 5 && *b2 == '1') || (p->w_zauto == 5 && p->w_zdisplay && *b2 == '8')) # 2155| { # 2156| if (++p->w_zauto < 6)