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 15b34b9050ada596903d8a8399ac233b169cfee9

Fix UB in fops_misc.c:gen_clone_name()
Replace postincrement with preincrement to avoid it.
Author: xaizek
Author date (UTC): 2025-05-02 07:47
Committer name: xaizek
Committer date (UTC): 2025-05-02 07:58
Parent(s): e620e2002c74d8e62f714f7d312dcfbbc9422507
Signing key: 99DC5E4DB05F6BE2
Tree: f7efee8bd3ee9f59e913349322b539a6cc2b5587
File Lines added Lines deleted
src/fops_misc.c 3 3
File src/fops_misc.c changed (mode: 100644) (index 2862cc1d1..88723738f)
... ... gen_clone_name(const char dir[], const char normal_name[])
930 930 cut_extension(result[0] == '.' ? &result[1] : result)); cut_extension(result[0] == '.' ? &result[1] : result));
931 931
932 932 len = strlen(result); len = strlen(result);
933 i = 1;
933 i = 0;
934 934 if(result[len - 1] == ')' && (p = strrchr(result, '(')) != NULL) if(result[len - 1] == ')' && (p = strrchr(result, '(')) != NULL)
935 935 { {
936 936 char *t; char *t;
 
... ... gen_clone_name(const char dir[], const char normal_name[])
938 938 if((l = strtoll(p + 1, &t, 10)) > 0 && t[1] == '\0' && l != LONG_LONG_MAX) if((l = strtoll(p + 1, &t, 10)) > 0 && t[1] == '\0' && l != LONG_LONG_MAX)
939 939 { {
940 940 len = p - result; len = p - result;
941 i = l + 1;
941 i = l;
942 942 } }
943 943 } }
944 944
945 945 do do
946 946 { {
947 snprintf(result + len, sizeof(result) - len, "(%lld)%s%s", i++,
947 snprintf(result + len, sizeof(result) - len, "(%lld)%s%s", ++i,
948 948 (extension[0] == '\0') ? "" : ".", extension); (extension[0] == '\0') ? "" : ".", extension);
949 949 } }
950 950 while(path_exists_at(dir, result, NODEREF)); while(path_exists_at(dir, result, NODEREF));
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