Skip to content

Fix various build warnings#1414

Merged
vmg merged 1 commit into
libgit2:developmentfrom
arrbee:more-build-warning-fixes
Mar 14, 2013
Merged

Fix various build warnings#1414
vmg merged 1 commit into
libgit2:developmentfrom
arrbee:more-build-warning-fixes

Conversation

@arrbee

@arrbee arrbee commented Mar 14, 2013

Copy link
Copy Markdown
Member

This fixes various build warnings on Mac and Windows (64-bit).

There are two noteworthy changes, I think.

  1. I replaced a strcpy with a memcpy in git_reference__alloc() because the string length is known (which is why the strcpy was safe).
  2. In winhttp.c:put_uuid_string() I replaced the call to wsprintfW with StringCbPrintfW which takes an extra parameter to ensure that the output buffer is not overrun. To be honest, I'm really not sure about this change, but there was a Windows deprecation warning for the old function and this is what MSDN recommended (and a sprintf that's not a snprintf always makes me nervous even though this was being checked beforehand).

I also removed some duplicated parameter validation code in winhttp.c:get_temp_file() and tried to clean up the associated code a bit.

This fixes various build warnings on Mac and Windows (64-bit).
@vmg

vmg commented Mar 14, 2013

Copy link
Copy Markdown
Member

The wsprintf change looks just fine. Thanks @arrbee!

vmg pushed a commit that referenced this pull request Mar 14, 2013
@vmg vmg merged commit e953c16 into libgit2:development Mar 14, 2013
@arrbee arrbee deleted the more-build-warning-fixes branch November 22, 2013 08:27
phatblat pushed a commit to phatblat/libgit2 that referenced this pull request Sep 13, 2014
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.

2 participants