Skip to content

Commit

Permalink
prevent overflow on gdocs strcat if HOME envvar is long
Browse files Browse the repository at this point in the history
ossfuzz issue 66527
  • Loading branch information
aureliendavid committed Feb 7, 2024
1 parent 00eb620 commit 37712e4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/filter_core/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1122,12 +1122,13 @@ Bool filter_solve_gdocs(const char *url, char szPath[GF_MAX_PATH])
#endif

if (path && path[0]) {
strcpy(szPath, path);
strncpy(szPath, path, GF_MAX_PATH-1);
szPath[GF_MAX_PATH-1] = 0;
u32 len = (u32) strlen(szPath);
if ((szPath[len-1]=='/') || (szPath[len-1]=='\\'))
szPath[len-1]=0;

strcat(szPath, url+6);
strncat(szPath, url+6, GF_MAX_PATH-strlen(szPath)-1);
return GF_TRUE;
}
return GF_FALSE;
Expand Down

0 comments on commit 37712e4

Please sign in to comment.