durable_rules 0.34.18 → 0.34.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/src/rules/events.c +46 -46
- data/src/rules/net.c +8 -8
- data/src/rules/regex.c +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c9e5f1398313b056da22ae2f5f3f2e530290b13
|
4
|
+
data.tar.gz: 4c855b1f826d50b56b092c5c7f16a45ad26fe4d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ed7203164847dbb9a410f737150dbb0e4b65a2cbe786066e97eb0f7aab9e008cbbd56c89a2a7fda94a44706c07a8334f856ade7590801e76a94403670898c08
|
7
|
+
data.tar.gz: c9a0aa9a35890f73c1236716287a7ec380b2ccaa5fd3d7a843b753f45d3debb79dc975f7666ef76c58ef24650c7d9ad441a34e676ad511c8d0972eabd78fb1cf
|
data/src/rules/events.c
CHANGED
@@ -381,9 +381,9 @@ static unsigned int handleBeta(ruleset *tree,
|
|
381
381
|
|
382
382
|
node *actionNode = NULL;
|
383
383
|
#ifdef _WIN32
|
384
|
-
|
384
|
+
char *prefix = (char *)_alloca(sizeof(char)*(prefixLength));
|
385
385
|
#else
|
386
|
-
|
386
|
+
char prefix[prefixLength];
|
387
387
|
#endif
|
388
388
|
char *currentPrefix = prefix;
|
389
389
|
currentNode = betaNode;
|
@@ -777,11 +777,11 @@ static unsigned int isMatch(ruleset *tree,
|
|
777
777
|
{
|
778
778
|
rightLength = rightProperty->valueLength + 1;
|
779
779
|
#ifdef _WIN32
|
780
|
-
|
781
|
-
|
780
|
+
char *leftStringInt = (char *)_alloca(sizeof(char)*(rightLength));
|
781
|
+
sprintf_s(leftStringInt, sizeof(char)*(rightLength), "%ld", currentProperty->value.i);
|
782
782
|
#else
|
783
|
-
|
784
|
-
|
783
|
+
char leftStringInt[rightLength];
|
784
|
+
snprintf(leftStringInt, sizeof(char)*(rightLength), "%ld", currentProperty->value.i);
|
785
785
|
#endif
|
786
786
|
*propertyMatch = compareStringProperty(leftStringInt,
|
787
787
|
rightState + rightProperty->valueOffset,
|
@@ -802,11 +802,11 @@ static unsigned int isMatch(ruleset *tree,
|
|
802
802
|
{
|
803
803
|
rightLength = rightProperty->valueLength + 1;
|
804
804
|
#ifdef _WIN32
|
805
|
-
|
806
|
-
|
805
|
+
char *leftStringDouble = (char *)_alloca(sizeof(char)*(rightLength));
|
806
|
+
sprintf_s(leftStringDouble, sizeof(char)*(rightLength), "%f", currentProperty->value.d);
|
807
807
|
#else
|
808
|
-
|
809
|
-
|
808
|
+
char leftStringDouble[rightLength];
|
809
|
+
snprintf(leftStringDouble, sizeof(char)*(rightLength), "%f", currentProperty->value.d);
|
810
810
|
#endif
|
811
811
|
*propertyMatch = compareStringProperty(leftStringDouble,
|
812
812
|
rightState + rightProperty->valueOffset,
|
@@ -832,11 +832,11 @@ static unsigned int isMatch(ruleset *tree,
|
|
832
832
|
{
|
833
833
|
leftLength = currentProperty->valueLength + 1;
|
834
834
|
#ifdef _WIN32
|
835
|
-
|
836
|
-
|
835
|
+
char *rightStringInt = (char *)_alloca(sizeof(char)*(leftLength));
|
836
|
+
sprintf_s(rightStringInt, sizeof(char)*(leftLength), "%ld", rightProperty->value.i);
|
837
837
|
#else
|
838
|
-
|
839
|
-
|
838
|
+
char rightStringInt[leftLength];
|
839
|
+
snprintf(rightStringInt, sizeof(char)*(leftLength), "%ld", rightProperty->value.i);
|
840
840
|
#endif
|
841
841
|
*propertyMatch = compareString(message + currentProperty->valueOffset,
|
842
842
|
currentProperty->valueLength,
|
@@ -848,11 +848,11 @@ static unsigned int isMatch(ruleset *tree,
|
|
848
848
|
{
|
849
849
|
leftLength = currentProperty->valueLength + 1;
|
850
850
|
#ifdef _WIN32
|
851
|
-
|
852
|
-
|
851
|
+
char *rightStringDouble = (char *)_alloca(sizeof(char)*(leftLength));
|
852
|
+
sprintf_s(rightStringDouble, sizeof(char)*(leftLength), "%f", rightProperty->value.d);
|
853
853
|
#else
|
854
|
-
|
855
|
-
|
854
|
+
char rightStringDouble[leftLength];
|
855
|
+
snprintf(rightStringDouble, sizeof(char)*(leftLength), "%f", rightProperty->value.d);
|
856
856
|
#endif
|
857
857
|
*propertyMatch = compareString(message + currentProperty->valueOffset,
|
858
858
|
currentProperty->valueLength,
|
@@ -1064,9 +1064,9 @@ static unsigned int handleMessageCore(ruleset *tree,
|
|
1064
1064
|
return result;
|
1065
1065
|
}
|
1066
1066
|
#ifdef _WIN32
|
1067
|
-
|
1067
|
+
char *sid = (char *)_alloca(sizeof(char)*(sidLength + 1));
|
1068
1068
|
#else
|
1069
|
-
|
1069
|
+
char sid[sidLength + 1];
|
1070
1070
|
#endif
|
1071
1071
|
strncpy(sid, message + sidProperty->valueOffset, sidLength);
|
1072
1072
|
sid[sidLength] = '\0';
|
@@ -1076,9 +1076,9 @@ static unsigned int handleMessageCore(ruleset *tree,
|
|
1076
1076
|
return result;
|
1077
1077
|
}
|
1078
1078
|
#ifdef _WIN32
|
1079
|
-
|
1079
|
+
char *mid = (char *)_alloca(sizeof(char)*(midLength + 1));
|
1080
1080
|
#else
|
1081
|
-
|
1081
|
+
char mid[midLength + 1];
|
1082
1082
|
#endif
|
1083
1083
|
strncpy(mid, message + midProperty->valueOffset, midLength);
|
1084
1084
|
mid[midLength] = '\0';
|
@@ -1223,27 +1223,27 @@ static unsigned int handleMessageCore(ruleset *tree,
|
|
1223
1223
|
return result;
|
1224
1224
|
}
|
1225
1225
|
#ifdef _WIN32
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1226
|
+
char *stateMessage = (char *)_alloca(sizeof(char)*(36 + sidLength));
|
1227
|
+
char *newState = (char *)_alloca(sizeof(char)*(12 + sidLength));
|
1228
|
+
if (sidProperty->type == JSON_STRING) {
|
1229
|
+
sprintf_s(stateMessage, sizeof(char)*(36 + sidLength), "{\"id\":\"$s\", \"sid\":\"%s\", \"$s\":1}", sid);
|
1230
|
+
sprintf_s(newState, sizeof(char)*(12 + sidLength), "{\"sid\":\"%s\"}", sid);
|
1231
|
+
}
|
1232
|
+
else {
|
1233
|
+
sprintf_s(stateMessage, sizeof(char)*(36 + sidLength), "{\"id\":\"$s\", \"sid\":%s, \"$s\":1}", sid);
|
1234
|
+
sprintf_s(newState, sizeof(char)*(12 + sidLength), "{\"sid\":%s}", sid);
|
1235
|
+
}
|
1236
1236
|
#else
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1237
|
+
char stateMessage[36 + sidLength];
|
1238
|
+
char newState[12 + sidLength];
|
1239
|
+
if (sidProperty->type == JSON_STRING) {
|
1240
|
+
snprintf(stateMessage, sizeof(char)*(36 + sidLength), "{\"id\":\"$s\", \"sid\":\"%s\", \"$s\":1}", sid);
|
1241
|
+
snprintf(newState, sizeof(char)*(12 + sidLength), "{\"sid\":\"%s\"}", sid);
|
1242
|
+
}
|
1243
|
+
else {
|
1244
|
+
snprintf(stateMessage, sizeof(char)*(36 + sidLength), "{\"id\":\"$s\", \"sid\":%s, \"$s\":1}", sid);
|
1245
|
+
snprintf(newState, sizeof(char)*(12 + sidLength), "{\"sid\":%s}", sid);
|
1246
|
+
}
|
1247
1247
|
#endif
|
1248
1248
|
|
1249
1249
|
if (*commandCount == MAX_COMMAND_COUNT) {
|
@@ -1415,15 +1415,15 @@ static unsigned int handleState(ruleset *tree,
|
|
1415
1415
|
|
1416
1416
|
char *stateMessagePostfix = state + 1;
|
1417
1417
|
#ifdef _WIN32
|
1418
|
-
|
1418
|
+
char *stateMessage = (char *)_alloca(sizeof(char)*(40 + stateLength - 1));
|
1419
1419
|
#else
|
1420
|
-
|
1420
|
+
char stateMessage[40 + stateLength - 1];
|
1421
1421
|
#endif
|
1422
1422
|
|
1423
1423
|
#ifdef _WIN32
|
1424
|
-
sprintf_s(stateMessage, 40 + stateLength - 1, "{\"id\":\"$v-%016lu\", \"$s\":1, %s", stateVersion, stateMessagePostfix);
|
1424
|
+
sprintf_s(stateMessage, sizeof(char)*(40 + stateLength - 1), "{\"id\":\"$v-%016lu\", \"$s\":1, %s", stateVersion, stateMessagePostfix);
|
1425
1425
|
#else
|
1426
|
-
|
1426
|
+
snprintf(stateMessage, sizeof(char)*(40 + stateLength - 1), "{\"id\":\"$v-%016lu\", \"$s\":1, %s", stateVersion, stateMessagePostfix);
|
1427
1427
|
#endif
|
1428
1428
|
unsigned int result = handleMessage(tree,
|
1429
1429
|
state,
|
data/src/rules/net.c
CHANGED
@@ -1244,11 +1244,11 @@ static unsigned int loadEvalMessageCommand(ruleset *tree, binding *rulesBinding)
|
|
1244
1244
|
|
1245
1245
|
#ifdef _WIN32
|
1246
1246
|
char *actionKey = (char *)_alloca(sizeof(char) * (nameLength + 3));
|
1247
|
-
sprintf_s(actionKey, nameLength + 3, "%s!a", name);
|
1247
|
+
sprintf_s(actionKey, sizeof(char) * (nameLength + 3), "%s!a", name);
|
1248
1248
|
node **sortedActions = (node **)_alloca(sizeof(node *) * tree->nodeOffset);
|
1249
1249
|
#else
|
1250
1250
|
char actionKey[nameLength + 3];
|
1251
|
-
snprintf(actionKey, nameLength + 3, "%s!a", name);
|
1251
|
+
snprintf(actionKey, sizeof(char) * (nameLength + 3), "%s!a", name);
|
1252
1252
|
node *sortedActions[tree->nodeOffset];
|
1253
1253
|
#endif
|
1254
1254
|
|
@@ -2411,13 +2411,13 @@ unsigned int formatEvalMessage(void *rulesBinding,
|
|
2411
2411
|
char score[11];
|
2412
2412
|
char keysLengthString[5];
|
2413
2413
|
#ifdef _WIN32
|
2414
|
-
sprintf_s(keysLengthString, 5, "%d", keysLength);
|
2415
|
-
sprintf_s(score, 11, "%ld", currentTime);
|
2414
|
+
sprintf_s(keysLengthString, sizeof(char) * 5, "%d", keysLength);
|
2415
|
+
sprintf_s(score, sizeof(char) * 11, "%ld", currentTime);
|
2416
2416
|
char **argv = (char **)_alloca(sizeof(char*)*(8 + keysLength + propertiesLength * 3));
|
2417
2417
|
size_t *argvl = (size_t *)_alloca(sizeof(size_t)*(8 + keysLength + propertiesLength * 3));
|
2418
2418
|
#else
|
2419
|
-
snprintf(keysLengthString, 5, "%d", keysLength);
|
2420
|
-
snprintf(score, 11, "%ld", currentTime);
|
2419
|
+
snprintf(keysLengthString, sizeof(char) * 5, "%d", keysLength);
|
2420
|
+
snprintf(score, sizeof(char) * 11, "%ld", currentTime);
|
2421
2421
|
char *argv[8 + keysLength + propertiesLength * 3];
|
2422
2422
|
size_t argvl[8 + keysLength + propertiesLength * 3];
|
2423
2423
|
#endif
|
@@ -2497,11 +2497,11 @@ unsigned int formatStoreMessage(void *rulesBinding,
|
|
2497
2497
|
binding *bindingContext = (binding*)rulesBinding;
|
2498
2498
|
char keysLengthString[5];
|
2499
2499
|
#ifdef _WIN32
|
2500
|
-
sprintf_s(keysLengthString, 5, "%d", keysLength);
|
2500
|
+
sprintf_s(keysLengthString, sizeof(char) * 5, "%d", keysLength);
|
2501
2501
|
char **argv = (char **)_alloca(sizeof(char*)*(6 + keysLength + propertiesLength * 3));
|
2502
2502
|
size_t *argvl = (size_t *)_alloca(sizeof(size_t)*(6 + keysLength + propertiesLength * 3));
|
2503
2503
|
#else
|
2504
|
-
snprintf(keysLengthString, 5, "%d", keysLength);
|
2504
|
+
snprintf(keysLengthString, sizeof(char) * 5, "%d", keysLength);
|
2505
2505
|
char *argv[6 + keysLength + propertiesLength * 3];
|
2506
2506
|
size_t argvl[6 + keysLength + propertiesLength * 3];
|
2507
2507
|
#endif
|
data/src/rules/regex.c
CHANGED
@@ -606,9 +606,10 @@ static void deleteTransition(state *previousState, unsigned short index) {
|
|
606
606
|
static void unlinkStates(state *previousState,
|
607
607
|
state *nextState,
|
608
608
|
unsigned int tokenSymbol) {
|
609
|
+
unsigned short nextId = nextState->id;
|
609
610
|
for (int i = 0; i < previousState->transitionsLength; ++i) {
|
610
611
|
if (previousState->transitions[i].symbol == tokenSymbol &&
|
611
|
-
previousState->transitions[i].next->id ==
|
612
|
+
previousState->transitions[i].next->id == nextId) {
|
612
613
|
deleteTransition(previousState, i);
|
613
614
|
}
|
614
615
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: durable_rules
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.34.
|
4
|
+
version: 0.34.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesus Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|