Skip to content

Commit

Permalink
msLoadFontSet(): fix null pointer dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault authored and github-actions[bot] committed Oct 6, 2022
1 parent 63cf884 commit e2a6d22
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion maplabel.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ int msLoadFontSet(fontSetObj *fontset, mapObj *map)
char szPath[MS_MAXPATHLEN];
int i;
int bFullPath = 0;
const char* realpath;

if(fontset->numfonts != 0) /* already initialized */
return(0);
Expand All @@ -821,7 +822,12 @@ int msLoadFontSet(fontSetObj *fontset, mapObj *map)
/* return(-1); */
/* } */

stream = VSIFOpenL( msBuildPath(szPath, fontset->map->mappath, fontset->filename), "rb");
realpath = msBuildPath(szPath, fontset->map->mappath, fontset->filename);
if( !realpath ) {
free(path);
return -1;
}
stream = VSIFOpenL( realpath, "rb");
if(!stream) {
msSetError(MS_IOERR, "Error opening fontset %s.", "msLoadFontset()",
fontset->filename);
Expand Down

0 comments on commit e2a6d22

Please sign in to comment.