Replace remaining SCStrndup calls

Replace them with BytesToString().
pull/809/merge
Victor Julien 12 years ago
parent c07f5397f4
commit 74fb60c010

@ -119,10 +119,11 @@ static void LogQuery(LogDnsLogThread *aft, json_t *js, DNSTransaction *tx, DNSQu
/* query */ /* query */
char *c; char *c;
c = SCStrndup((char *)((char *)entry + sizeof(DNSQueryEntry)), entry->len); c = BytesToString((uint8_t *)((uint8_t *)entry + sizeof(DNSQueryEntry)), entry->len);
if (c != NULL) {
json_object_set_new(djs, "rrname", json_string(c)); json_object_set_new(djs, "rrname", json_string(c));
if (c != NULL)
SCFree(c); SCFree(c);
}
/* name */ /* name */
char record[16] = ""; char record[16] = "";
@ -151,10 +152,10 @@ static void OutputAnswer(LogDnsLogThread *aft, json_t *djs, DNSTransaction *tx,
/* query */ /* query */
if (entry->fqdn_len > 0) { if (entry->fqdn_len > 0) {
char *c; char *c;
c = SCStrndup((char *)((char *)entry + sizeof(DNSAnswerEntry)), c = BytesToString((uint8_t *)((uint8_t *)entry + sizeof(DNSAnswerEntry)),
entry->fqdn_len); entry->fqdn_len);
json_object_set_new(js, "rrname", json_string(c));
if (c != NULL) { if (c != NULL) {
json_object_set_new(js, "rrname", json_string(c));
SCFree(c); SCFree(c);
} }
} }

@ -49,6 +49,7 @@
#include "util-file.h" #include "util-file.h"
#include "util-time.h" #include "util-time.h"
#include "util-buffer.h" #include "util-buffer.h"
#include "util-byte.h"
#include "output.h" #include "output.h"
#include "output-json.h" #include "output-json.h"
@ -190,7 +191,7 @@ static void FileWriteJsonRecord(JsonFileLogThread *aft, const Packet *p, const F
return; return;
} }
char *s = SCStrndup((char *)ff->name, ff->name_len); char *s = BytesToString(ff->name, ff->name_len);
json_object_set_new(fjs, "filename", json_string(s)); json_object_set_new(fjs, "filename", json_string(s));
if (s != NULL) if (s != NULL)
SCFree(s); SCFree(s);

Loading…
Cancel
Save