svn commit: samba r16390 - in branches/SAMBA_3_0/source/lib: .
jra at samba.org
jra at samba.org
Tue Jun 20 01:20:40 GMT 2006
Author: jra
Date: 2006-06-20 01:20:38 +0000 (Tue, 20 Jun 2006)
New Revision: 16390
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16390
Log:
Klocwork #604 - ensure if NULL pointer we assert
if len != 0.
Jeremy.
Modified:
branches/SAMBA_3_0/source/lib/messages.c
Changeset:
Modified: branches/SAMBA_3_0/source/lib/messages.c
===================================================================
--- branches/SAMBA_3_0/source/lib/messages.c 2006-06-20 01:20:33 UTC (rev 16389)
+++ branches/SAMBA_3_0/source/lib/messages.c 2006-06-20 01:20:38 UTC (rev 16390)
@@ -105,6 +105,7 @@
void *buf, size_t len)
{
const char *msg = buf ? buf : "none";
+
DEBUG(1,("INFO: Received PING message from PID %s [%s]\n",
procid_str_static(&src), msg));
message_send_pid(src, MSG_PONG, buf, len, True);
@@ -198,6 +199,11 @@
char *ptr;
struct message_rec prec;
+ /* NULL pointer means implicit length zero. */
+ if (!buf) {
+ SMB_ASSERT(len == 0);
+ }
+
/*
* Doing kill with a non-positive pid causes messages to be
* sent to places we don't want.
@@ -209,7 +215,7 @@
rec.msg_type = msg_type;
rec.dest = pid;
rec.src = procid_self();
- rec.len = len;
+ rec.len = buf ? len : 0;
kbuf = message_key_pid(pid);
@@ -218,7 +224,7 @@
return False;
memcpy(dbuf.dptr, &rec, sizeof(rec));
- if (len > 0)
+ if (len > 0 && buf)
memcpy((void *)((char*)dbuf.dptr+sizeof(rec)), buf, len);
dbuf.dsize = len + sizeof(rec);
More information about the samba-cvs
mailing list