Ad Widget

Collapse

PATCH: SIGSEGV in DBget_maxid

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • schneck
    Member
    • May 2006
    • 62

    #1

    PATCH: SIGSEGV in DBget_maxid

    Hi,

    (at least) on OpenBSD 4.1, one of the zabbix_server processes dies with SIGSEGV when trying to send the first alert ever (ie, the ``nextid'' for alerts in the ``ids'' table does not exist).

    After rewriting the format string to no longer use the %3$s syntax, alerts started working. We are still researching this from the OpenBSD side, but meanwhile, you might consider the appended patch if you experience the same problem.

    As I don't think this will affect zabbix in any way (except pushing 3 additional pointers on the stack for the function call), it might be of advantage to include it anyway.

    Best regards,

    \Bernhard.

    PS: this patch is again with respect to the ``developers'' pre-zabbix-1.5.tar.gz from 2008-02-18

    Code:
    --- ./src/libs/zbxdbhigh/db.c-dist      Mon Feb 18 11:00:17 2008
    +++ ./src/libs/zbxdbhigh/db.c   Wed Feb 20 19:39:06 2008
    @@ -1861,11 +1861,13 @@
                    if(NULL == (row = DBfetch(result))) {
                            DBfree_result(result);
     
    -                       result = DBselect("select max(%3$s) from %4$s where %3$s>="ZBX_FS_UI64" and %3$s<="ZBX_FS_UI64,
    +                       result = DBselect("select max(%s) from %s where %s>="ZBX_FS_UI64" and %s<="ZBX_FS_UI64,
    +                               fieldname,
    +                               tablename,
    +                               fieldname,
                                    min,
    -                               max,
                                    fieldname,
    -                               tablename);
    +                               max);
     
                            if(NULL == (row = DBfetch(result)) || SUCCEED == DBis_null(row[0]) || !*row[0])
                                    ret1 = min;
Working...