[patch] (was Re: [hobbit] bb download)

Malcolm Hunter malcolm.hunter at gmx.co.uk
Tue Dec 8 17:31:38 CET 2009


It seems it is a bug in the code. When msg is assigned the values, it's given the wrong length. Here's a patch that fixes the problem:


--- hobbitd.c   2009-12-08 16:20:54.000000000 +0000
+++ hobbitd.c.fixed     2009-12-08 16:19:04.000000000 +0000
@@ -1858,5 +1858,5 @@


-unsigned char *get_filecache(char *fn)
+unsigned char *get_filecache(char *fn, long *flen)
 {
        RbtIterator handle;
@@ -1872,4 +1872,5 @@
        result = (unsigned char *)malloc(item->len);
        memcpy(result, item->fdata, item->len);
+       flen = item->len;

        return result;
@@ -1948,9 +1949,10 @@
        struct stat st;
        unsigned char *result;
+       long flen;

        dbgprintf("-> get_binary %s\n", fn);
        sprintf(fullfn, "%s/download/%s", xgetenv("BBHOME"), fn);

-       result = get_filecache(fullfn);
+       result = get_filecache(fullfn, &flen);
        if (!result) {
                fd = open(fullfn, O_RDONLY);
@@ -1974,7 +1976,8 @@

                add_filecache(fullfn, result, st.st_size);
+               flen = st.st_size;
        }

-       msg->buflen = st.st_size;
+       msg->buflen = flen;
        msg->buf = result;
        msg->bufp = msg->buf + msg->buflen;



-- 
Technical copy-editor & proofreader

KDE Proofreading Team
KDE British English Translation Team

http://l10n.kde.org/team-infos.php?teamcode=en_GB

Facebook: http://www.facebook.com/FriendlyAtheist

Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser



More information about the Xymon mailing list