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 5ea32dce950c5d015b2c20d298aed6ee2a7d4cbe

Fix a leak on parsing of malformed 'viewcolumns'
And also in case of allocation failure, but that's very unlikely.

Discovered by Coverity.
Author: xaizek
Author date (UTC): 2025-04-28 17:27
Committer name: xaizek
Committer date (UTC): 2025-05-02 07:58
Parent(s): fca75884691dbb6cc12872ce095bdc67c880f36a
Signing key: 99DC5E4DB05F6BE2
Tree: d752fb20f14cda223992860aea05608f30b3bee5
File Lines added Lines deleted
ChangeLog 2 0
src/viewcolumns_parser.c 15 1
File ChangeLog changed (mode: 100644) (index 870a9d272..3e99de63a)
63 63
64 64 Fixed a memory leak on formatting tab line when there is not enough space. Fixed a memory leak on formatting tab line when there is not enough space.
65 65
66 Fixed an unlikely memory leak on parsing of malformed 'viewcolumns'.
67
66 68 0.14-beta to 0.14 (2025-02-08) 0.14-beta to 0.14 (2025-02-08)
67 69
68 70 Improved documentation on zh/zl menu keys a bit. Improved documentation on zh/zl menu keys a bit.
File src/viewcolumns_parser.c changed (mode: 100644) (index 041c34efc..33226b3cf)
... ... parse_all(map_name_cb cn, const char str[], size_t *len, void *arg)
87 87 { {
88 88 break; break;
89 89 } }
90
90 91 if(info.sizing == ST_PERCENT && (percents += info.full_width) > 100) if(info.sizing == ST_PERCENT && (percents += info.full_width) > 100)
91 92 { {
93 free_info(&info);
92 94 break; break;
93 95 } }
96
94 97 if(extend_column_list(&list, &list_len) == 0) if(extend_column_list(&list, &list_len) == 0)
95 98 { {
96 99 list[list_len - 1] = info; list[list_len - 1] = info;
97 100 } }
101 else
102 {
103 free_info(&info);
104 }
98 105 } }
99 106 free(str_copy); free(str_copy);
100 107
 
... ... parse(map_name_cb cn, const char str[], column_info_t *info, void *arg)
169 176 } }
170 177 } }
171 178
172 return str == NULL || *str != '\0';
179 /* Either something has failed or we didn't parse format until the end. */
180 if(str == NULL || *str != '\0')
181 {
182 free_info(info);
183 return 1;
184 }
185
186 return 0;
173 187 } }
174 188
175 189 /* Initializes info structure with default values. */ /* Initializes info structure with default values. */
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