1
0
mirror of https://git.disroot.org/80486DX2-66/polonium.git synced 2024-12-26 23:20:22 +05:30

main.c: use custom path length limit

This commit is contained in:
Intel A80486DX2-66 2024-10-12 11:12:12 +03:00
parent 0380d97c0f
commit d69475406b
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B
2 changed files with 3 additions and 1 deletions

View File

@ -83,6 +83,8 @@ typedef off_t file_offset_t;
# define FILE_OFFSET_C(x) ((off_t) x) # define FILE_OFFSET_C(x) ((off_t) x)
#endif #endif
#define MAX_PATH_LENGTH_PLUS_1 256
/* macros: lambdas */ /* macros: lambdas */
#define STRINGIZE(x) #x #define STRINGIZE(x) #x
#define INT2STR(x) STRINGIZE(x) #define INT2STR(x) STRINGIZE(x)

View File

@ -106,7 +106,7 @@ static char* my_basename(const char* raw_path) {
if (path == NULL) if (path == NULL)
return NULL; return NULL;
char* base = malloc(FILENAME_MAX * sizeof(char)); char* base = malloc(MAX_PATH_LENGTH_PLUS_1 * sizeof(char));
if (base == NULL) { if (base == NULL) {
free(path); free(path);