Skip to content

Fix normalisation of absolute paths#4963

Merged
jtanx merged 1 commit intofontforge:masterfrom
jtanx:ffb
Mar 23, 2022
Merged

Fix normalisation of absolute paths#4963
jtanx merged 1 commit intofontforge:masterfrom
jtanx:ffb

Conversation

@jtanx
Copy link
Copy Markdown
Contributor

@jtanx jtanx commented Mar 23, 2022

#4956 depends on the path being normalised, but the fallback path for older glib versions doesn't do anything if the path is absolute. This changes it to always normalise paths. Also fixes potential buffer overflows on long path names.

Type of change

  • Bug fix

Copy link
Copy Markdown
Contributor

@skef skef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment thread gutils/fsys.c
strcat(buffer,"/");
strcat(buffer,name);

buffer = smprintf("%s/%s", dirname_, name);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming getcwd won't return a trailing slash, hence removing that check.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More like the code below already deals with removing redundant slashes, so there's no point checking for it here

@jtanx jtanx merged commit a8be73b into fontforge:master Mar 23, 2022
@jtanx jtanx deleted the ffb branch March 23, 2022 20:43
Omnikron13 pushed a commit to Omnikron13/fontforge that referenced this pull request May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants