If buffer length is 0, force pointer to NULL, to keep valgrind happier when callers...
authorKen Raeburn <raeburn@mit.edu>
Sat, 17 Jan 2009 01:00:22 +0000 (01:00 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 17 Jan 2009 01:00:22 +0000 (01:00 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21762 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/write_msg.c

index 7586c9b8696a11183246a343eb34f4f7ff266b94..e6001e8c67bea792c2777700d7954d1fe19d12b6 100644 (file)
@@ -52,11 +52,13 @@ krb5int_write_messages(krb5_context context, krb5_pointer fdp, krb5_data *outbuf
            nbufs1 = 1;
        len[0] = htonl(outbuf[0].length);
        SG_SET(&sg[0], &len[0], 4);
-       SG_SET(&sg[1], outbuf[0].data, outbuf[0].length);
+       SG_SET(&sg[1], outbuf[0].length ? outbuf[0].data : NULL,
+              outbuf[0].length);
        if (nbufs1 == 2) {
            len[1] = htonl(outbuf[1].length);
            SG_SET(&sg[2], &len[1], 4);
-           SG_SET(&sg[3], outbuf[1].data, outbuf[1].length);
+           SG_SET(&sg[3], outbuf[1].length ? outbuf[1].data : NULL,
+                  outbuf[1].length);
        }
        if (krb5int_net_writev(context, fd, sg, nbufs1 * 2) < 0) {
            return errno;