Skip to content

Commit 082c8ed

Browse files
Merge pull request #747 from robertdavidgraham/integration
ISAKMP parser
2 parents 017e8a0 + 309d021 commit 082c8ed

File tree

7 files changed

+530
-35
lines changed

7 files changed

+530
-35
lines changed

src/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,6 +1816,8 @@ int main(int argc, char *argv[])
18161816
*/
18171817
{
18181818
int x = 0;
1819+
extern int proto_isakmp_selftest(void);
1820+
18191821
x += massip_selftest();
18201822
x += ranges6_selftest();
18211823
x += dedup_selftest();
@@ -1830,6 +1832,7 @@ int main(int argc, char *argv[])
18301832
x += siphash24_selftest();
18311833
x += ntp_selftest();
18321834
x += snmp_selftest();
1835+
x += proto_isakmp_selftest();
18331836
x += templ_payloads_selftest();
18341837
x += blackrock_selftest();
18351838
x += rawsock_selftest();

src/out-binary.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ binary_out_status_ipv6(struct Output *out, FILE *fp, time_t timestamp,
104104
int status, ipaddress ip, unsigned ip_proto, unsigned port, unsigned reason, unsigned ttl)
105105
{
106106
unsigned char buf[256+1];
107-
size_t max = sizeof(buf-1);
107+
size_t max = sizeof(buf)-1;
108108
size_t offset = 0;
109109
size_t bytes_written;
110110

src/proto-banout.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <stddef.h>
1717
#include <string.h>
1818
#include <stdlib.h>
19+
#include <stdarg.h>
1920

2021
/***************************************************************************
2122
***************************************************************************/
@@ -284,6 +285,41 @@ banout_expand(struct BannerOutput *banout, struct BannerOutput *p)
284285
return n;
285286
}
286287

288+
289+
290+
291+
292+
293+
/***************************************************************************
294+
***************************************************************************/
295+
static void
296+
banout_vprintf(struct BannerOutput *banout, unsigned proto,
297+
const char *fmt, va_list marker) {
298+
char str[10];
299+
int len;
300+
301+
len = vsnprintf(str, sizeof(str), fmt, marker);
302+
if (len > sizeof(str)-1) {
303+
char *tmp = malloc(len+1);
304+
vsnprintf(tmp, len+1, fmt, marker);
305+
banout_append(banout, proto, tmp, len);
306+
free(tmp);
307+
} else {
308+
banout_append(banout, proto, str, len);
309+
}
310+
}
311+
312+
/***************************************************************************
313+
***************************************************************************/
314+
void
315+
banout_printf(struct BannerOutput *banout, unsigned proto, const char *fmt, ...) {
316+
va_list marker;
317+
318+
va_start(marker, fmt);
319+
banout_vprintf(banout, proto, fmt, marker);
320+
va_end(marker);
321+
}
322+
287323
/***************************************************************************
288324
***************************************************************************/
289325
void

src/proto-banout.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ void
5959
banout_append(struct BannerOutput *banout, unsigned proto, const void *px, size_t length);
6060
#define AUTO_LEN ((size_t)~0)
6161

62+
void
63+
banout_printf(struct BannerOutput *banout, unsigned proto, const char *fmt, ...);
64+
6265
/**
6366
* Append a single character to the banner.
6467
*/

0 commit comments

Comments
 (0)