Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

giterr format#4002

Merged
carlosmn merged 5 commits intolibgit2:masterlibgit2/libgit2:masterfrom
pks-t:pks/giterr-formatpks-t/libgit2:pks/giterr-formatCopy head branch name to clipboard
Nov 14, 2016
Merged

giterr format#4002
carlosmn merged 5 commits intolibgit2:masterlibgit2/libgit2:masterfrom
pks-t:pks/giterr-formatpks-t/libgit2:pks/giterr-formatCopy head branch name to clipboard

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.