Ticket #17: jabberd-2.1.6-nullstring.patch

File jabberd-2.1.6-nullstring.patch, 1.1 KB (added by sxw, 20 months ago)

Updated fix

  • jabberd-2.1.6/util/config.c

    old new  
    209209                elem->attrs[elem->nvalues][j] = pstrdupx(xhash_pool(c->hash), NAD_ANAME(bd.nad, attr), NAD_ANAME_L(bd.nad, attr)); 
    210210                elem->attrs[elem->nvalues][j + 1] = pstrdupx(xhash_pool(c->hash), NAD_AVAL(bd.nad, attr), NAD_AVAL_L(bd.nad, attr)); 
    211211 
     212                /*  
     213                 * pstrdupx(blob, 0) returns NULL - which means that later 
     214                 * there's no way of telling whether an attribute is defined 
     215                 * as empty, or just not defined. This fixes that by creating 
     216                 * an empty string for attributes which are defined empty 
     217                 */ 
     218                if (NAD_AVAL_L(bd.nad, attr)==0) { 
     219                    elem->attrs[elem->nvalues][j + 1] = pstrdup(xhash_pool(c->hash), ""); 
     220                } else { 
     221                    elem->attrs[elem->nvalues][j + 1] = pstrdupx(xhash_pool(c->hash), NAD_AVAL(bd.nad, attr), NAD_AVAL_L(bd.nad, attr)); 
     222                } 
    212223                j += 2; 
    213224                attr = bd.nad->attrs[attr].next; 
    214225            }