[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20010426: NWX table additions, srchw.c



A few NWX table additions for bulletins in our data stream.

stf.bull:
FPUS61 KCTP    (replaces KPBZ)
FPUS65 KVEF    (Southern Nevada)

rgtmpc.stn:
RTPAJK
RTPFGZ
RTPMEM
RTPSJT
RTPTLH

smw.bull:
WHUS51 KBOX    (KBOS is in the table currently)

mws.bull:
FZAK87 PAJK 

Also, 
in srchw.c I have a core dump when a bulletin has '\0' in it.
In_getrpt(), line 648 currently has:
   iepos = (int) strchr( &text[reportInfo[srchinfo->current].position],
                                                CHCTLC);

strchr can return NULL when a '\0' in a bulletin occurs before CHCTLC is
found. As a result, the calculation
rep_len = iepos - ispos;
leads to an enormous rep_len value causing the strncpy() command in line 651 
to blow up.

I changed the strchr command to memchr, and added a check for iepos = 0.


        iepos = (int)memchr (&text[reportInfo[srchinfo->current].position],  
CHCTLC, 
           (srchinfo->file_info.file_len -  
reportInfo[srchinfo->current].position));

        if(iepos != 0)
           rep_len = iepos - ispos;
        else
           rep_len = 0;



Steve

---------------------------------------------

Steve Chiswell
Unidata User Support