Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++] file.name() corrupts its arg #157

Open
marcgurevitx opened this issue Jul 10, 2024 · 2 comments
Open

[C++] file.name() corrupts its arg #157

marcgurevitx opened this issue Jul 10, 2024 · 2 comments

Comments

@marcgurevitx
Copy link
Contributor

marcgurevitx commented Jul 10, 2024

p = "a/b/"
file.name p
print "[" + p + "]"  // prints: "[a/b"  -- no closing "]"
@marcgurevitx
Copy link
Contributor Author

Probably found the trouble maker (from man 3 basename on Linux):

Both dirname() and basename() may modify the contents of path, so it may be desirable to pass a copy when calling one of these functions.

@marcgurevitx
Copy link
Contributor Author

Yes. strdup() fixed the issue on my machine.

marcgurevitx added a commit to marcgurevitx/miniscript-by-jjs that referenced this issue Jul 10, 2024
borgi pushed a commit to borgi/csucsu_miniscript that referenced this issue Nov 21, 2024
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

No branches or pull requests

1 participant