Skip to content

Commit

Permalink
Standard Libraries: vsnprintf_ss: fix assert check on uninitialized v…
Browse files Browse the repository at this point in the history
…ariable.

Variable n is not yet initialized when the _DIAGASSERT() check is performed
on it, which means any old garbage in n may or may not cause the assert
to occur.  I believe this is a cut-n-paste error from vsnprintf() where
n is used as a paramater, where as vsnprintf_ss() does not.

Fix this by not asserting on n.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Colin Ian King <[email protected]>
  • Loading branch information
Colin Ian King committed Apr 28, 2015
1 parent 6e74654 commit 89e0f3b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion StdLib/LibC/Stdio/vsnprintf_ss.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ vsnprintf_ss(char *sbuf, size_t slen, const char *fmt0, va_list ap)
static const char xdigs_upper[16] = "0123456789ABCDEF";


_DIAGASSERT(n == 0 || sbuf != NULL);
_DIAGASSERT(sbuf != NULL);
_DIAGASSERT(fmt != NULL);

tailp = sbuf + slen;
Expand Down

1 comment on commit 89e0f3b

@jljusten
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the first line of the commit message too long?

https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format

I think 'Standard Libraries' on the first line of the commit message should be changed to 'StdLib'.

Please sign in to comment.