argus-clients-3.0.0.rc.14 user data print patch

Peter Van Epp vanepp at sfu.ca
Thu Jun 29 23:45:44 EDT 2006


	Below is a patch against argus-clients-3.0.0.rc.14 to fix a user data
printing bug (actually two of them :-)). In the case where there is no data
conbuf doesn't get zeroed and the source data prints in the dest field 
(presumably garbage will print in the source field should it have no data).
Adding and moving the bcopy before the data test fixes this (and makes ra_test
a lot happier). There is still a bug in counts somewhere though:

ra2: ,s[4]=":/A.",
ra3: ,s[8]=":/A.....",

which will likely be next on the agenda.

Peter Van Epp / Operations and Technical Support 
Simon Fraser University, Burnaby, B.C. Canada


*** common/argus_util.c.orig	Thu Jun 29 20:18:36 2006
--- common/argus_util.c	Thu Jun 29 20:30:45 2006
***************
*** 8108,8113 ****
--- 8108,8114 ----
        exlen += 8;
        if (len > 10) exlen++;
  
+       bzero (conbuf, sizeof(conbuf));
        if ((user = (struct ArgusDataStruct *)argus->dsrs[ARGUS_SRCUSERDATA_INDEX]) != NULL) {
           unsigned short *sptr = &user->hdr.argus_dsrvl16.len;
           slen = (*sptr - 2 ) * 4;
***************
*** 8170,8175 ****
--- 8171,8177 ----
        exlen += 8;
        if (len > 10) exlen++;
  
+       bzero (conbuf, sizeof(conbuf));
        if ((user = (struct ArgusDataStruct *)argus->dsrs[ARGUS_DSTUSERDATA_INDEX]) != NULL) {
           unsigned short *sptr = &user->hdr.argus_dsrvl16.len;
           slen = (*sptr - 2 ) * 4;
***************
*** 8177,8183 ****
           slen = (slen > len) ? len : slen;
       
           bzero (strbuf, sizeof(strbuf));
-          bzero (conbuf, sizeof(conbuf));
  
           if ((slen = ArgusEncode (parser, (const char *)&user->array, NULL, slen, str, sizeof(strbuf))) > 0)
              sprintf (con, "d[%d]=%s", slen, str);
--- 8179,8184 ----



More information about the argus mailing list