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

@ -49,6 +49,7 @@
#include "util-file.h"
#include "util-time.h"
#include "util-buffer.h"
#include "util-byte.h"
#include "output.h"
#include "output-json.h"
@ -190,7 +191,7 @@ static void FileWriteJsonRecord(JsonFileLogThread *aft, const Packet *p, const F
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));
if (s != NULL)
SCFree(s);

Loading…
Cancel
Save