BIFScanner: Make filename->symbol transformation more robust

When trying to build bro from a path that contained a plus sign, an
invalid symbol name for the #ifdef guard was generated.
This commit is contained in:
Hilko Bengen 2014-11-26 20:55:22 +01:00
parent d17aedcc44
commit fc71572aad

View file

@ -1,4 +1,5 @@
%{ %{
#include <ctype.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include "bif_arg.h" #include "bif_arg.h"
@ -223,7 +224,7 @@ void init_alternative_mode()
for ( char* p = guard; *p; p++ ) for ( char* p = guard; *p; p++ )
{ {
if ( strchr("/.-", *p) ) if ( !isalnum (*p) )
*p = '_'; *p = '_';
} }