-
-
Notifications
You must be signed in to change notification settings - Fork 904
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
-Werror=format-security #680
Comments
Hello! Thank you for reporting this. Is it really an issue, though? What's actionable? Have you looked at the code? Do you have recommendations on how to fix? Why is "Werror=format-security" important to you in this context? Wouldn't this be a discussion better had on nokogiri-talk? |
Hello, github was just the first communication channel I found suitable for this "bug" report. I didn't know about nokogiri-talk. :)
The error points to line 189 in xml_xpath_context.c, but I suppose it's Currently, I think this might work: va_start(args, ctx);
vasprintf(&message, "%s", args); Note: I haven't tested this yet, as I just built it without Should I post this on nokogiri-talk, too? Cheers, Alex |
There is a difference between
which emits a compiler warning, and
which causes the compiler to fail with a fatal error. Ubuntu turns on warnings by default, not errors. So it's not apparent to me why you're failing above; unless you've got "-Werror" set as part of your personal development setup. In this case, the free-text format string being used is emitted by libxml2 warnings. So, why is this an issue? There is no obvious exploit for this, unless the libxml2 library has been compromised. And, well, I would have preferred if you'd posted to the mailing list so that this conversation was transparent and available. See http://bit.ly/nokohelp for Team Nokogiri's rationale. But no biggie now. |
Ah, my bad. Just found out I don't know whether this is an issue; I took hardening as applying general best-practices. Thus, reporting it here, may it be an actual error. :) Ay ay, will post to nokogiri-talk next time. |
To be honest, I'm not sure myself when and how the error part comes into play. |
In this case, since the format string is returned by libxml2 (along with the args to the string, suitable for a call to vasprintf), it's not obvious to me that there are any security implications. Reading the gcc man page, it doesn't seem like I can add any sort of pragma declaration to the line to tell the compiler "hey, now, this time it's OK to call vasprintf". Though, there is an interesting other gcc argument, Can you come up with any changes to |
I've just added a seperate Will also try to find out whether there's a general way to check for hardening-wrapper being used. |
This will make installing nokogiri on all debian wheezy system difficult, it would be good to have a work around (even if it's not nokogiri's fault) |
@yob - Did you read the comment above where we discover that this is only an issue if you're using the hardening-wrapper? If so, then please add some context so we know what you're referring to. (Is hardening-wrapper installed by default in Wheezy?) |
Hardened build flags is a release goal for wheezy. So they're definitely However, I received this error just by running 'gem install nokogiri' on a
|
It looks like mkmf.rb sets CFLAGS based on the flags that were used to build ruby (by looking up RbConfig::CONFIG["CFLAGS"]) Since MRI 1.9.3p194 on debian ruby is built with -Werror=format-security, so without hand holding the nokogiri gem won't build and install. |
thanks, 1.5.4 compiles and installs as normal. |
thanks! |
can someone please fix this? |
When building nokogiri's native extensions with GCC 4.6.3 on Ubuntu and -Werror=format-security enabled, this error appears:
The text was updated successfully, but these errors were encountered: