Browse code

silence cid 12218 - false positive, yara virname prefix

Kevin Lin authored on 2015/08/18 01:48:59
Showing 2 changed files
... ...
@@ -3468,11 +3468,11 @@ static int load_oneyara(YR_RULE *rule, int chkpua, struct cl_engine *engine, uns
3468 3468
 
3469 3469
     newident = cli_malloc(strlen(rule->identifier) + 5 + 1);
3470 3470
     if(!newident) {
3471
-	cli_errmsg("cli_loadyara(): newident == NULL\n");
3472
-	return CL_EMEM;
3471
+        cli_errmsg("cli_loadyara(): newident == NULL\n");
3472
+        return CL_EMEM;
3473 3473
     }
3474 3474
 
3475
-    sprintf(newident, "YARA.%s", rule->identifier);
3475
+    snprintf(newident, strlen(rule->identifier) + 5 + 1, "YARA.%s", rule->identifier);
3476 3476
 
3477 3477
     if(engine->cb_sigload && engine->cb_sigload("yara", newident, ~options & CL_DB_OFFICIAL, engine->cb_sigload_ctx)) {
3478 3478
         cli_dbgmsg("cli_loadyara: skipping %s due to callback\n", newident);
... ...
@@ -2204,8 +2204,9 @@ inline static char *get_paren_end(char *hexstr)
2204 2204
 
2205 2205
 static char *decodehexspecial(const char *hex, unsigned int *dlen)
2206 2206
 {
2207
-    char *pt, *start, *hexcpy, *decoded, *h, *e, *c, op, lop;
2208
-	unsigned int i, len = 0, hlen, negative, level;
2207
+	char *pt, *start, *hexcpy, *decoded, *h, *e, *c, op, lop;
2208
+	unsigned int i, len = 0, hlen, negative;
2209
+	int level;
2209 2210
 	char *buff;
2210 2211
 
2211 2212
     hexcpy = NULL;