Am Montag, 4. Dezember 2006 18:59 schrieb Jan Kandziora:
>
----Schnipp----
>
I found another bug in owtcl. If an invalid request is forwarded to owlib, it 
doesn't change the reply buffer pointer at all, not even to NULL.
This e.g. leads to:


% OW::get bus.0/uncached/68689/present
*** glibc detected *** free(): invalid pointer: 0x080552d8 ***
Aborted
janskiste:~ #


To avoid having a patch of a patch, I made a collaboration patch for both 
problems:

--- module/swig/tcl/ow.c.orig   2006-12-04 17:55:23.000000000 +0100
+++ module/swig/tcl/ow.c        2006-12-04 22:28:12.000000000 +0100
@@ -178,15 +178,21 @@
     }
   }

+  buf=NULL;
   r = OW_get(path, &buf, &ss);
   s = ss ; // to get around OW_get uses size_t
   if ( r<0 ) {
     owtcl_ErrorMsg(interp, strerror(-r));
-    free(buf);
+    if (buf) free(buf);
     tcl_return = TCL_ERROR;
     goto common_exit;
   }

+  if (buf==NULL) {
+    tcl_return = TCL_OK;
+    goto common_exit;
+  }
+
   buf[s] = 0;
   if (lst) {
     if (strchr(buf, ',')) {

Kind regards

        Jan
-- 
Wie kann eigentlich eine 1:1-Kopie nicht wörtlich sein?
Wahrscheinlich hat das Fernsehen meine Phantasie zerstört.
(Das habe ich jetzt nicht-wörtlich von den Simpsons geklaut,
selbst wäre ich zu einem solchen Gedanken natürlich nicht imstande.)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to