binpac: Remove use of Variable-Length-Arrays

Related to https://github.com/zeek/zeek/issues/895
This commit is contained in:
Jon Siwek 2020-04-15 16:23:11 -07:00 committed by Tim Wojtulewicz
parent db7c3d7c5c
commit 9de6212dda

View file

@ -10,7 +10,7 @@ const char *RegEx::kMatchPrefix = "MatchPrefix";
string escape_char(const string &s) string escape_char(const string &s)
{ {
char buf[s.length() * 2 + 1]; char* buf = new char[s.length() * 2 + 1];
int j = 0; int j = 0;
for ( int i = 0; i < (int) s.length(); ++i ) for ( int i = 0; i < (int) s.length(); ++i )
{ {
@ -40,7 +40,9 @@ string escape_char(const string &s)
buf[j++] = '\0'; buf[j++] = '\0';
return string(buf); string rval = buf;
delete [] buf;
return rval;
} }
RegEx::RegEx(const string &s) RegEx::RegEx(const string &s)