diff options
author | Benny Baumann <BenBE@geshi.org> | 2023-07-28 12:56:00 +0200 |
---|---|---|
committer | Benny Baumann <BenBE@geshi.org> | 2023-07-28 12:56:00 +0200 |
commit | 958057f01ab304f9effb716668084d5c2f92ffec (patch) | |
tree | 25624d9ac3637145aa0b66e2ae99580b8cf7d8d8 /OpenFilesScreen.c | |
parent | 30256a77c86e69d0f212f638d1e498fc5749dbd2 (diff) |
Avoid VLA in OpenFiles screen
Diffstat (limited to 'OpenFilesScreen.c')
-rw-r--r-- | OpenFilesScreen.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/OpenFilesScreen.c b/OpenFilesScreen.c index 4256575c..2e782b98 100644 --- a/OpenFilesScreen.c +++ b/OpenFilesScreen.c @@ -252,10 +252,8 @@ static void OpenFilesScreen_scan(InfoScreen* this) { OpenFiles_FileData* fdata = pdata->files; while (fdata) { OpenFiles_Data* data = &fdata->data; - size_t lenN = strlen(getDataForType(data, 'n')); - size_t sizeEntry = 5 + 7 + 4 + 10 + 10 + 10 + 10 + lenN + 8 /*spaces*/ + 1 /*null*/; - char entry[sizeEntry]; - xSnprintf(entry, sizeof(entry), "%5.5s %-7.7s %-4.4s %-10.10s %10.10s %10.10s %10.10s %s", + char* entry = NULL; + xAsprintf(&entry, "%5.5s %-7.7s %-4.4s %-10.10s %10.10s %10.10s %10.10s %s", getDataForType(data, 'f'), getDataForType(data, 't'), getDataForType(data, 'a'), @@ -265,6 +263,7 @@ static void OpenFilesScreen_scan(InfoScreen* this) { getDataForType(data, 'i'), getDataForType(data, 'n')); InfoScreen_addLine(this, entry); + free(entry); OpenFiles_Data_clear(data); OpenFiles_FileData* old = fdata; fdata = fdata->next; |