[Snort-devel] I don't known whether it's right or not!

Cist bnu100875 at ...131...
Wed Nov 29 07:46:07 EST 2000


I downloaded the Snort 1.6.3 source code - (New Release 7-22-2000),and have successed in compiling it.But when I excuted it with the preprocessor portscan,I encounter an error.It incorrectly parsed the log directory.
In the file spp_portscan.c,I think the following lines should be modified.

/***** In the function ParsePortscanArgs()
if (pv.log_dir && (*toks[3] != '/'))
           //   ..........  !='\\'))
        {
            if (*(pv.log_dir + strlen(pv.log_dir) - 1) != '/')
                                         //        ....!='\\')
            {
                logFileName = malloc(strlen(pv.log_dir) + strlen(toks[3]) + 1 + 1);
            strncpy(logFileName, pv.log_dir, strlen(pv.log_dir));
          //            ......,...........,strlen(pv.log_dir)+1);       
                strncat(logFileName, "/", 1);
          //                  .....,"\\",1);
                strncat(logFileName, toks[3], strlen(toks[3]));
            }
            else
            {
                logFileName = malloc(strlen(pv.log_dir) + strlen(toks[3]) + 1);
                strncpy(logFileName, pv.log_dir, strlen(pv.log_dir));
                //                 ............,strlen(pv.log_dir)+1);
                strncat(logFileName, toks[3], strlen(toks[3]));
            }
        }
        else
        {
            logFileName = (char *)malloc(strlen(toks[3]) + 1);
            strncpy(logFileName, toks[3], strlen(toks[3]));
              //               .........,strlen(toks[3])+1);
        }

beacause:
1)The strncpy function copies the initial count characters of strSource to strDest.If count is equal to the length of strSource, a null character is not appended automatically to the copied string. 
2)In Windows,the separator in path is '\\'.


______________________________________

===================================================================
���������������� http://mail.sina.com.cn
������������������������������ 
http://sms.sina.com.cn/



More information about the Snort-devel mailing list