# HG changeset patch # User Paper # Date 1643256761 18000 # Node ID d2cd8c5672fa14ea4f2fefe065bad45ef076fdba # Parent 9d862edfd3ccd742180c6ff6620779318f1305cb Increase filename limit 256 bytes is enough for anybody diff -r 9d862edfd3cc -r d2cd8c5672fa src/gui.c --- a/src/gui.c Wed Jan 26 22:32:41 2022 -0500 +++ b/src/gui.c Wed Jan 26 23:12:41 2022 -0500 @@ -11,7 +11,7 @@ HWND hWndListBox, hWndComboBox; int16_t version = 11, type = 1; /* type: 0 is vf, 1 is veg */ -char* file_name = " "; /* initialize as a space, a filename cannot literally just be a space */ +char* file_name = " "; /* initialize as a space, a (windows) filename can't just be a space */ void set_data(unsigned char magic[], uint16_t version, FILE* target) { int i; @@ -64,14 +64,14 @@ char* open_file(HWND hWnd) { OPENFILENAME ofn; - char filename[127]; + char filename[256]; ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hWnd; ofn.lpstrFile = filename; ofn.lpstrFile[0] = '\0'; - ofn.nMaxFile = 127; + ofn.nMaxFile = 256; ofn.lpstrFilter = "Project files\0*.veg;*.vf\0All files\0*.*\0"; ofn.nFilterIndex = 1; @@ -88,14 +88,14 @@ return; } OPENFILENAME ofn; - char output_file[127]; + char output_file[256]; ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hWnd; ofn.lpstrFile = output_file; ofn.lpstrFile[0] = '\0'; - ofn.nMaxFile = 127; + ofn.nMaxFile = 256; ofn.lpstrFilter = "Project files\0*.veg\0All files\0*.*\0"; ofn.nFilterIndex = 1; diff -r 9d862edfd3cc -r d2cd8c5672fa src/main.c --- a/src/main.c Wed Jan 26 22:32:41 2022 -0500 +++ b/src/main.c Wed Jan 26 23:12:41 2022 -0500 @@ -73,10 +73,10 @@ unsigned char magic[16]; FILE* outfile; struct arguments { - char input[128]; - char output[128]; + char input[256]; + char output[256]; int version; - char type[128]; + char type[256]; } args; strcpy(args.input, " "); strcpy(args.output, " "); @@ -147,16 +147,16 @@ } fflush(stdout); if (strcmp(args.output, " ") == 0) { /* string manipulation hell */ - char temp[128] = {'V'}; + char temp[256] = {'V'}; char str_version[16] = {}; sprintf(str_version, "%d", args.version); strncat(temp, str_version, 2); strncat(temp, "_", 1); - strncat(temp, args.input, 120); + strncat(temp, args.input, 248); strcpy(temp, strremove(temp, strrchr(args.input, ('.')))); /* remove file extension */ strncat(temp, ".", 1); strncat(temp, args.type, 3); - strncpy(args.output, temp, 127); + strncpy(args.output, temp, 255); } if (strcmp(args.type, "veg") == 0) { const unsigned char T[] = {0xEF, 0x29, 0xC4, 0x46, 0x4A, 0x90, 0xD2, 0x11, 0x87, 0x22, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A};