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 418204dba0e9d47b51103c856b853034cbd97c79

Be more carefull with realloc() in one more place
Found by clang-checker.
Author: xaizek
Author date (UTC): 2012-10-18 14:55
Committer name: xaizek
Committer date (UTC): 2012-10-18 14:55
Parent(s): 12293e47d8dbdd5c11af8acdb343cdd106e99aa3
Signing key:
Tree: 7fa8622b8ecadd8658ecebd1c40d75f476afcf88
File Lines added Lines deleted
src/engine/cmds.c 10 4
File src/engine/cmds.c changed (mode: 100644) (index abe4bb5c3..5af652ec6)
19 19 #include <assert.h> #include <assert.h>
20 20 #include <ctype.h> #include <ctype.h>
21 21 #include <stdio.h> #include <stdio.h>
22 #include <stdlib.h>
22 #include <stdlib.h> /* realloc() */
23 23 #include <string.h> #include <string.h>
24 24
25 25 #include "../utils/log.h" #include "../utils/log.h"
 
... ... list_udf_content(const char *beginning)
1340 1340 result = NULL; result = NULL;
1341 1341 while(cur != NULL) while(cur != NULL)
1342 1342 { {
1343 void *ptr;
1344
1343 1345 if(strncmp(cur->name, beginning, len) != 0 || cur->type != USER_CMD) if(strncmp(cur->name, beginning, len) != 0 || cur->type != USER_CMD)
1344 1346 { {
1345 1347 cur = cur->next; cur = cur->next;
 
... ... list_udf_content(const char *beginning)
1351 1353 result = strdup("Command -- Action"); result = strdup("Command -- Action");
1352 1354 result_len = strlen(result); result_len = strlen(result);
1353 1355 } }
1354 result = realloc(result,
1356 ptr = realloc(result,
1355 1357 result_len + 1 + strlen(cur->name) + 10 + strlen(cur->cmd) + 1); result_len + 1 + strlen(cur->name) + 10 + strlen(cur->cmd) + 1);
1356 result_len += sprintf(result + result_len, "\n%-*s %s", 10, cur->name,
1357 cur->cmd);
1358 if(ptr != NULL)
1359 {
1360 result = ptr;
1361 result_len += sprintf(result + result_len, "\n%-*s %s", 10, cur->name,
1362 cur->cmd);
1363 }
1358 1364 cur = cur->next; cur = cur->next;
1359 1365 } }
1360 1366
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