Revision: 48394
          http://brlcad.svn.sourceforge.net/brlcad/?rev=48394&view=rev
Author:   starseeker
Date:     2012-01-11 16:12:34 +0000 (Wed, 11 Jan 2012)
Log Message:
-----------
Check for null pc->pkc_buf - CID 258

Modified Paths:
--------------
    brlcad/trunk/src/libpkg/pkg.c

Modified: brlcad/trunk/src/libpkg/pkg.c
===================================================================
--- brlcad/trunk/src/libpkg/pkg.c       2012-01-11 16:08:44 UTC (rev 48393)
+++ brlcad/trunk/src/libpkg/pkg.c       2012-01-11 16:12:34 UTC (rev 48394)
@@ -1484,10 +1484,15 @@
        return (char *)0;
 
     /* Read the whole message into the dynamic buffer */
-    if ((i = _pkg_inget(pc, pc->pkc_buf, pc->pkc_len)) != pc->pkc_len) {
+    if (pc->pkc_buf != (char *)0) {
+      if ((i = _pkg_inget(pc, pc->pkc_buf, pc->pkc_len)) != pc->pkc_len) {
        snprintf(_pkg_errbuf, MAX_PKG_ERRBUF_SIZE,
-                "pkg_bwaitfor: _pkg_inget %ld gave %ld\n", (long)pc->pkc_len, 
(long)i);
+           "pkg_bwaitfor: _pkg_inget %ld gave %ld\n", (long)pc->pkc_len, 
(long)i);
        (pc->pkc_errlog)(_pkg_errbuf);
+      } 
+    } else {
+      snprintf(_pkg_errbuf, MAX_PKG_ERRBUF_SIZE, "pkg_bwaitfor: tried to read 
from null pc->pkc_buf!\n");
+      return (char *)0;
     }
     tmpbuf = pc->pkc_buf;
     pc->pkc_buf = (char *)0;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to