nano-8.4-1.fc43

List of Findings

Error: SHELLCHECK_WARNING (CWE-758): [#def1]
/etc/profile.d/nano-default-editor.sh:1:1: error[SC2148]: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
#    1|-> # Ensure GNU nano is set as EDITOR if it isn't already set
#    2|   
#    3|   if [ -z "$EDITOR" ]; then

Error: GCC_ANALYZER_WARNING (CWE-476): [#def2]
nano-8.4/build/src/../../src/history.c:403:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘lastitem’
nano-8.4/build/src/../../src/history.c:472:6: enter_function: entry to ‘reload_positions_if_needed’
nano-8.4/build/src/../../src/history.c:480:39: branch_false: following ‘false’ branch (when ‘item’ is NULL)...
nano-8.4/build/src/../../src/history.c:486:9: branch_false: ...to here
nano-8.4/build/src/../../src/history.c:486:9: release_memory: ‘0’ is NULL
nano-8.4/build/src/../../src/history.c:488:9: call_function: calling ‘load_poshistory’ from ‘reload_positions_if_needed’
#  401|   			position_history = newitem;
#  402|   		else
#  403|-> 			lastitem->next = newitem;
#  404|   
#  405|   		lastitem = newitem;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def3]
nano-8.4/build/src/../../src/history.c:538:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘previous’
nano-8.4/build/src/../../src/history.c:493:6: enter_function: entry to ‘update_poshistory’
nano-8.4/build/src/../../src/history.c:499:12: branch_false: following ‘false’ branch...
nano-8.4/build/src/../../src/history.c:504:9: call_function: calling ‘reload_positions_if_needed’ from ‘update_poshistory’
nano-8.4/build/src/../../src/history.c:504:9: return_function: returning to ‘update_poshistory’ from ‘reload_positions_if_needed’
nano-8.4/build/src/../../src/history.c:507:14: release_memory: ‘item’ is NULL
nano-8.4/build/src/../../src/history.c:507:39: branch_false: following ‘false’ branch (when ‘item’ is NULL)...
nano-8.4/build/src/../../src/history.c:514:21: branch_false: ...to here
nano-8.4/build/src/../../src/history.c:532:12: branch_true: following ‘true’ branch (when ‘item’ is NULL)...
nano-8.4/build/src/../../src/history.c:533:26: branch_true: ...to here
nano-8.4/build/src/../../src/history.c:535:21: release_memory: ‘previous’ is NULL
nano-8.4/build/src/../../src/history.c:535:20: branch_false: following ‘false’ branch...
nano-8.4/build/src/../../src/history.c:538:25: branch_false: ...to here
nano-8.4/build/src/../../src/history.c:538:25: danger: dereference of NULL ‘previous’
#  536|   			position_history = theone;
#  537|   		else
#  538|-> 			previous->next = theone;
#  539|   	} else if (item->next != NULL) {
#  540|   		if (previous == NULL)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
nano-8.4/build/src/../../src/text.c:526:56: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘line’
nano-8.4/build/src/../../src/text.c:3101:6: enter_function: entry to ‘complete_a_word’
nano-8.4/build/src/../../src/text.c:3117:12: branch_false: following ‘false’ branch...
nano-8.4/build/src/../../src/text.c:3138:17: branch_false: ...to here
nano-8.4/build/src/../../src/text.c:3138:17: call_function: calling ‘do_undo’ from ‘complete_a_word’
#  524|   			remove_magicline();
#  525|   		memmove(line->data + u->head_x, line->data + u->head_x + strlen(u->strdata),
#  526|-> 						strlen(line->data + u->head_x) - strlen(u->strdata) + 1);
#  527|   		goto_line_posx(u->head_lineno, u->head_x);
#  528|   		break;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def5]
nano-8.4/build/src/../../src/text.c:536:58: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘line’
nano-8.4/build/src/../../src/text.c:3101:6: enter_function: entry to ‘complete_a_word’
nano-8.4/build/src/../../src/text.c:3117:12: branch_false: following ‘false’ branch...
nano-8.4/build/src/../../src/text.c:3138:17: branch_false: ...to here
nano-8.4/build/src/../../src/text.c:3138:17: call_function: calling ‘do_undo’ from ‘complete_a_word’
#  534|   		original_x = (u->head_x == 0) ? u->tail_x : u->head_x;
#  535|   		regain_from_x = (u->head_x == 0) ? 0 : u->tail_x;
#  536|-> 		line->data = nrealloc(line->data, strlen(line->data) +
#  537|   								strlen(&u->strdata[regain_from_x]) + 1);
#  538|   		strcat(line->data, &u->strdata[regain_from_x]);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def6]
nano-8.4/build/src/../../src/text.c:548:39: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘line’
nano-8.4/build/src/../../src/text.c:3101:6: enter_function: entry to ‘complete_a_word’
nano-8.4/build/src/../../src/text.c:3117:12: branch_false: following ‘false’ branch...
nano-8.4/build/src/../../src/text.c:3138:17: branch_false: ...to here
nano-8.4/build/src/../../src/text.c:3138:17: call_function: calling ‘do_undo’ from ‘complete_a_word’
#  546|   	case DEL:
#  547|   		undidmsg = _("deletion");
#  548|-> 		data = nmalloc(strlen(line->data) + strlen(u->strdata) + 1);
#  549|   		strncpy(data, line->data, u->head_x);
#  550|   		strcpy(&data[u->head_x], u->strdata);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def7]
nano-8.4/build/src/../../src/text.c:566:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘line’
nano-8.4/build/src/../../src/text.c:3101:6: enter_function: entry to ‘complete_a_word’
nano-8.4/build/src/../../src/text.c:3117:12: branch_false: following ‘false’ branch...
nano-8.4/build/src/../../src/text.c:3138:17: branch_false: ...to here
nano-8.4/build/src/../../src/text.c:3138:17: call_function: calling ‘do_undo’ from ‘complete_a_word’
#  564|   			break;
#  565|   		}
#  566|-> 		line->data[u->tail_x] = '\0';
#  567|   		intruder = make_new_node(line);
#  568|   		intruder->data = copy_of(u->strdata);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def8]
nano-8.4/build/src/../../src/text.c:576:30: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘line’
nano-8.4/build/src/../../src/text.c:3101:6: enter_function: entry to ‘complete_a_word’
nano-8.4/build/src/../../src/text.c:3117:12: branch_false: following ‘false’ branch...
nano-8.4/build/src/../../src/text.c:3138:17: branch_false: ...to here
nano-8.4/build/src/../../src/text.c:3138:17: call_function: calling ‘do_undo’ from ‘complete_a_word’
#  574|   		undidmsg = _("replacement");
#  575|   		data = u->strdata;
#  576|-> 		u->strdata = line->data;
#  577|   		line->data = data;
#  578|   		goto_line_posx(u->head_lineno, u->head_x);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def9]
nano-8.4/build/src/../../src/utils.c:73:9: warning[-Wanalyzer-null-argument]: use of NULL ‘nmalloc(strlen(name) + pathlen + 1)’ where non-null expected
nano-8.4/build/src/../../src/utils.c:68:7: enter_function: entry to ‘concatenate’
nano-8.4/build/src/../../src/utils.c:71:24: call_function: calling ‘nmalloc’ from ‘concatenate’
nano-8.4/build/src/../../src/utils.c:71:24: return_function: returning to ‘concatenate’ from ‘nmalloc’
nano-8.4/build/src/../../src/utils.c:73:9: danger: argument 1 (‘nmalloc(strlen(name) + pathlen + 1)’) NULL where non-null expected
#argument 1 of ‘__builtin_strcpy’ must be non-null
#   71|   	char *joined = nmalloc(pathlen + strlen(name) + 1);
#   72|   
#   73|-> 	strcpy(joined, path);
#   74|   	strcpy(joined + pathlen, name);
#   75|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def10]
nano-8.4/build/src/../../src/utils.c:119:17: warning[-Wanalyzer-null-argument]: use of NULL ‘string’ where non-null expected
nano-8.4/build/src/../../src/utils.c:132:6: enter_function: entry to ‘parse_line_column’
nano-8.4/build/src/../../src/utils.c:143:12: branch_false: following ‘false’ branch (when ‘comma’ is non-NULL)...
nano-8.4/build/src/../../src/utils.c:146:18: branch_false: ...to here
nano-8.4/build/src/../../src/utils.c:148:12: branch_false: following ‘false’ branch (when ‘string != comma’)...
nano-8.4/build/src/../../src/utils.c:151:21: branch_false: ...to here
nano-8.4/build/src/../../src/utils.c:151:21: call_function: calling ‘copy_of’ from ‘parse_line_column’
nano-8.4/build/src/../../src/utils.c:151:21: return_function: returning to ‘parse_line_column’ from ‘copy_of’
nano-8.4/build/src/../../src/utils.c:154:18: call_function: calling ‘parse_num’ from ‘parse_line_column’
#  117|   	errno = 0;
#  118|   
#  119|-> 	value = (ssize_t)strtol(string, &excess, 10);
#  120|   
#  121|   	if (errno == ERANGE || *string == '\0' || *excess != '\0')

Error: GCC_ANALYZER_WARNING (CWE-476): [#def11]
nano-8.4/build/src/../../src/utils.c:332:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘nmalloc(count + 1)’
nano-8.4/build/src/../../src/utils.c:425:6: enter_function: entry to ‘new_magicline’
nano-8.4/build/src/../../src/utils.c:428:41: call_function: calling ‘copy_of’ from ‘new_magicline’
#  330|   
#  331|   	memcpy(thecopy, string, count);
#  332|-> 	thecopy[count] = '\0';
#  333|   
#  334|   	return thecopy;

Error: CPPCHECK_WARNING (CWE-457): [#def12]
nano-8.4/src/browser.c:403: warning[uninitvar]: Uninitialized variable: dir
#  401|   		dir = opendir(path);
#  402|   
#  403|-> 	if (path == NULL || dir == NULL) {
#  404|   		statusline(ALERT, _("Cannot open directory: %s"), strerror(errno));
#  405|   		/* If we don't have a file list, there is nothing to show. */

Error: COMPILER_WARNING: [#def13]
nano-8.4/src/history.c: scope_hint: In function ‘save_poshistory’
nano-8.4/src/history.c:456:44: warning[-Wstringop-overflow=]: writing 1 byte into a region of size 0
#  456 |                 path_and_place[length - 1] = '\n';
#      |                                            ^
nano-8.4/src/utils.c:294:25: note: at offset -1 into destination object of size [44, 9223372036854775807] allocated by ‘malloc’
#  294 |         void *section = malloc(howmuch);
#      |                         ^
#  454|   		length = recode_LF_to_NUL(path_and_place);
#  455|   		/* Restore the terminating newline. */
#  456|-> 		path_and_place[length - 1] = '\n';
#  457|   
#  458|   		if (fwrite(path_and_place, 1, length, histfile) < length)

Error: CPPCHECK_WARNING (CWE-457): [#def14]
nano-8.4/src/prompt.c:588: warning[uninitvar]: Uninitialized variable: input
#  586|   #endif
#  587|   
#  588|-> 	*actual = input;
#  589|   
#  590|   	return function;

Error: CPPCHECK_WARNING (CWE-682): [#def15]
nano-8.4/src/search.c:313: error[nullPointerArithmetic]: Overflow in pointer arithmetic, NULL pointer is subtracted.
#  311|   	}
#  312|   
#  313|-> 	found_x = found - line->data;
#  314|   
#  315|   	nodelay(midwin, FALSE);

Error: CPPCHECK_WARNING (CWE-457): [#def16]
nano-8.4/src/winio.c:2691: warning[uninitvar]: Uninitialized variable: endmatch.rm_eo
# 2689|   			/* Second step: look for starts on this line, but begin
# 2690|   			 * looking only after an end match, if there is one. */
# 2691|-> 			index = (paintlen == 0) ? 0 : endmatch.rm_eo;
# 2692|   
# 2693|   			while (index < PAINT_LIMIT && regexec(varnish->start, line->data + index,

Scan Properties

analyzer-version-clippy1.86.0
analyzer-version-cppcheck2.17.1
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-178.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250425.124705.g1c7c448.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namenano-8.4-1.fc43
store-results-to/tmp/tmperjhumsk/nano-8.4-1.fc43.tar.xz
time-created2025-04-25 14:32:59
time-finished2025-04-25 14:35:03
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmperjhumsk/nano-8.4-1.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmperjhumsk/nano-8.4-1.fc43.src.rpm'
tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9