From: Ken Raeburn Date: Sat, 29 Mar 2008 01:10:30 +0000 (+0000) Subject: Coverity CID 220: NULL check of "buf" after dereference X-Git-Tag: krb5-1.7-alpha1~698 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=965be2b05dae5e08a39781696d221182ec3acb34;p=krb5.git Coverity CID 220: NULL check of "buf" after dereference All call sites have previously dereferenced the pointer, but to keep the interface simple, keep the null check, and move the dereference to after it. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20300 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/gssapi/mechglue/g_glue.c b/src/lib/gssapi/mechglue/g_glue.c index 41759468f..f5bed4719 100644 --- a/src/lib/gssapi/mechglue/g_glue.c +++ b/src/lib/gssapi/mechglue/g_glue.c @@ -124,7 +124,7 @@ gssint_der_length_size(unsigned int len) int gssint_put_der_length(unsigned int length, unsigned char **buf, unsigned int max_len) { - unsigned char *s = *buf, *p; + unsigned char *s, *p; unsigned int buf_len = 0; int i, first; @@ -132,6 +132,8 @@ gssint_put_der_length(unsigned int length, unsigned char **buf, unsigned int max if (buf == 0 || max_len < 1) return (-1); + s = *buf; + /* Single byte is the length */ if (length < 128) { *s++ = length;