-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/go: cgo flags drops quotes. #12281
Comments
I'm running into this same issue. |
I had the same problem, When I try to use quickjs CGO_CFLAGS="-DCONFIG_VERSION=\"1.0.0\"" go build |
@ianlancetaylor Would you accept a fix for this? I would much rather not having to use a bash/makefile to just pass a CFLAG. |
I don't know what the fix would look like, but, yes, in principle, a fix for this would be fine (for the 1.17 release). |
I believe the bug is in Lines 1650 to 1660 in bc7e4d9
|
Okay, it seems like The proper solution would be to make Lines 1740 to 1759 in bc7e4d9
|
I think we need a clearer definition of what is safe and what is not. On the other hand, The attack we are protecting against is someone who provides a package with a |
Based on dba926d, I guess |
cc @rsc |
I know that in the past, parentheses have been deemed unsafe, as well. See #23911. I feel like there should be a better way to sanitize these strings. Thoughts? |
There doesn't seem to be a way to pass a quoted value with cgo flags.
I have also tried
'"3.2.4-0ae11a4"'
and some other variations, they all yield:can't load package: package test/cgoflag: /home/ome/go/src/test/cgoflag/main.go: malformed #cgo argument: VERSION="3.2.4-0ae11a4"
The text was updated successfully, but these errors were encountered: