Browse code

Properly fix CIDs 11364, 11365, 11353

Shawn Webb authored on 2013/02/09 04:25:13
Showing 1 changed files
... ...
@@ -2447,7 +2447,7 @@ static int cli_loadcrt(FILE *fs, struct cl_engine *engine, struct cli_dbio *dbio
2447 2447
             memcpy(ca.serial, serial, sizeof(ca.serial));
2448 2448
             free(serial);
2449 2449
         } else {
2450
-            memset(ca.serial, (int)'\xca', sizeof(ca.serial));
2450
+            memset(ca.serial, 0xca, sizeof(ca.serial));
2451 2451
         }
2452 2452
         pubkey = cli_hex2str(tokens[4]);
2453 2453
         cli_dbgmsg("cli_loadcrt: subject: %s\n", tokens[2]);
... ...
@@ -2517,9 +2517,15 @@ static int cli_loadcrt(FILE *fs, struct cl_engine *engine, struct cli_dbio *dbio
2517 2517
         crtmgr_add(&(engine->cmgr), &ca);
2518 2518
         free(subject);
2519 2519
         free(pubkey);
2520
+        subject = pubkey = NULL;
2520 2521
     }
2521 2522
 
2522 2523
 end:
2524
+    if (subject)
2525
+        free(subject);
2526
+    if (pubkey)
2527
+        free(pubkey);
2528
+
2523 2529
     cli_dbgmsg("Number of certs: %d\n", engine->cmgr.items);
2524 2530
     cli_crt_clear(&ca);
2525 2531
     return ret;