dp = f->sp;
}
- char proto[16];
- if (SCProtoNameValid(f->proto) == TRUE) {
- strlcpy(proto, known_proto[f->proto], sizeof(proto));
- } else {
- snprintf(proto, sizeof(proto), "%03" PRIu32, f->proto);
- }
-
/* time */
jb_set_string(jb, "timestamp", timebuf);
jb_set_uint(jb, "dest_port", dp);
break;
}
- jb_set_string(jb, "proto", proto);
+
+ if (SCProtoNameValid(f->proto)) {
+ jb_set_string(jb, "proto", known_proto[f->proto]);
+ } else {
+ char proto[4];
+ snprintf(proto, sizeof(proto), "%"PRIu8"", f->proto);
+ jb_set_string(jb, "proto", proto);
+ }
+
switch (f->proto) {
case IPPROTO_ICMP:
case IPPROTO_ICMPV6:
-/* Copyright (C) 2014 Open Information Security Foundation
+/* Copyright (C) 2014-2020 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
dp = f->sp;
}
- char proto[16];
- if (SCProtoNameValid(f->proto) == TRUE) {
- strlcpy(proto, known_proto[f->proto], sizeof(proto));
- } else {
- snprintf(proto, sizeof(proto), "%03" PRIu32, f->proto);
- }
-
/* time */
jb_set_string(js, "timestamp", timebuf);
jb_set_uint(js, "dest_port", dp);
break;
}
- jb_set_string(js, "proto", proto);
+
+ if (SCProtoNameValid(f->proto)) {
+ jb_set_string(js, "proto", known_proto[f->proto]);
+ } else {
+ char proto[4];
+ snprintf(proto, sizeof(proto), "%"PRIu8"", f->proto);
+ jb_set_string(js, "proto", proto);
+ }
+
switch (f->proto) {
case IPPROTO_ICMP:
case IPPROTO_ICMPV6: {