Thanks to visit codestin.com
Credit goes to github.com

Skip to content

giterr format #4002

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

Merged
merged 5 commits into from
Nov 14, 2016
Merged

giterr format #4002

merged 5 commits into from
Nov 14, 2016

Conversation

pks-t
Copy link
Member

@pks-t pks-t commented Nov 14, 2016

While inspecting #4000, I've been very surprised to find out that we were passing a git_buf pointer to giterr_set without any warning of the compiler. Seems we didn't put a printf-attribute hint at the declaration, causing the compiler to accept whatever we put there.

Next to the many cases of "%d" instead of "%"PRIuZ which can cause us to overflow in the output, there were also three real errors where we passed a structure pointer to "%s" instead of the real value.

@carlosmn
Copy link
Member

While this shouldn't have any effect on that issue as the address of a struct is the address of its first field, it's a good idea to tell the compiler about the printf format and fix its warnings.

@carlosmn carlosmn merged commit e1c1433 into libgit2:master Nov 14, 2016
@ethomson
Copy link
Member

Nice, thanks!

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.

3 participants