From 965be2b05dae5e08a39781696d221182ec3acb34 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Sat, 29 Mar 2008 01:10:30 +0000 Subject: [PATCH] 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 --- src/lib/gssapi/mechglue/g_glue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.26.2