Skip to content

Commit 2513144

Browse files
committed
fix: fix a bug that caused todox to crash when using list arg
This bug was cause because the task name length was being incorrectly calculated, so the error 'corrupt size vs prev_size' was being thrown when realocing the tasks array.
1 parent e77225d commit 2513144

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/registry.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ int parseRegistry(FILE *taskRegistry, Task *out_tasks[], int *out_tasksLen) {
162162
char *token = strtok(lineTmp, ",");
163163

164164
while (token) {
165-
int taskNameLen = strlen(token) - 1;
165+
int taskNameLen = strlen(token) + 1;
166166
char *taskName = (char *)malloc(taskNameLen);
167167
if (taskName == NULL) {
168168
fprintf(stderr, "Memory allocation failed");

0 commit comments

Comments
 (0)