xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit d7db8482df0a65c0a42e23e39b8d928d497d2e1e

Fix possible one byte stack array overflow
Suggested by clang static analyser.
Author: xaizek
Author date (UTC): 2013-01-06 18:33
Committer name: xaizek
Committer date (UTC): 2013-01-06 18:33
Parent(s): 4f0d2700bc058d1adacc0d4bc4cb0e6ddec7fe11
Signing key:
Tree: ead14e98208d7338debb64fd120cae7df5118110
File Lines added Lines deleted
src/engine/cmds.c 1 1
tests/commands/input_tests.c 12 0
File src/engine/cmds.c changed (mode: 100644) (index a6e2c1bc6..bceee1503)
... ... get_cmd_name(const char cmd[], char buf[], size_t buf_len)
657 657 while(isalpha(*t)) while(isalpha(*t))
658 658 t++; t++;
659 659
660 len = MIN(t - cmd, buf_len);
660 len = MIN(t - cmd, buf_len - 1);
661 661 strncpy(buf, cmd, len); strncpy(buf, cmd, len);
662 662 buf[len] = '\0'; buf[len] = '\0';
663 663 if(*t == '?' || *t == '!') if(*t == '?' || *t == '!')
File tests/commands/input_tests.c changed (mode: 100644) (index b2250b0fd..3fe224aa6)
... ... test_qmark_and_bg(void)
586 586 assert_true(cmdi.qmark); assert_true(cmdi.qmark);
587 587 } }
588 588
589 static void
590 test_extra_long_command_name(void)
591 {
592 char cmd_name[1024];
593
594 memset(cmd_name, 'a', sizeof(cmd_name) - 1);
595 cmd_name[sizeof(cmd_name) - 1] = '\0';
596
597 assert_false(execute_cmd(cmd_name) == 0);
598 }
599
589 600 void void
590 601 input_tests(void) input_tests(void)
591 602 { {
 
... ... input_tests(void)
620 631 run_test(test_bg_and_no_args); run_test(test_bg_and_no_args);
621 632 run_test(test_short_forms); run_test(test_short_forms);
622 633 run_test(test_qmark_and_bg); run_test(test_qmark_and_bg);
634 run_test(test_extra_long_command_name);
623 635
624 636 test_fixture_end(); test_fixture_end();
625 637 } }
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master