git://git.onelab.eu
/
fprobe-ulog.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
581cfdb
)
Fix memory bugs.
author
Andy Bavier
<acb@cs.princeton.edu>
Tue, 1 Oct 2013 20:53:23 +0000
(16:53 -0400)
committer
Andy Bavier
<acb@cs.princeton.edu>
Tue, 1 Oct 2013 20:53:23 +0000
(16:53 -0400)
src/fprobe-ulog.c
patch
|
blob
|
history
diff --git
a/src/fprobe-ulog.c
b/src/fprobe-ulog.c
index
c77c638
..
e939dab
100644
(file)
--- a/
src/fprobe-ulog.c
+++ b/
src/fprobe-ulog.c
@@
-1505,7
+1505,7
@@
bad_lhost:
/* Process collectors parameters. Brrrr... :-[ */
npeers = argc - optind;
/* Process collectors parameters. Brrrr... :-[ */
npeers = argc - optind;
- if (npeers > 1) {
+ if (npeers >
=
1) {
/* Send to remote Netflow collector */
if (!(peers = malloc(npeers * sizeof(struct peer)))) goto err_malloc;
for (i = optind, npeers = 0; i < argc; i++, npeers++) {
/* Send to remote Netflow collector */
if (!(peers = malloc(npeers * sizeof(struct peer)))) goto err_malloc;
for (i = optind, npeers = 0; i < argc; i++, npeers++) {
@@
-1570,10
+1570,8
@@
bad_collector:
}
else if (parms[fflag].count) {
// log into a file
}
else if (parms[fflag].count) {
// log into a file
- if (!(peers = malloc(npeers * sizeof(struct peer)))) goto err_malloc;
- if (!(peers[npeers].fname = malloc(strnlen(parms[fflag].arg,MAX_PATH_LEN)))) goto err_malloc;
- strncpy(peers[npeers].fname, parms[fflag].arg, MAX_PATH_LEN);
-
+ if (!(peers = malloc(sizeof(struct peer)))) goto err_malloc;
+ if (!(peers[npeers].fname = strndup(parms[fflag].arg, MAX_PATH_LEN))) goto err_malloc;
peers[npeers].write_fd = START_DATA_FD;
peers[npeers].type = PEER_FILE;
peers[npeers].seq = 0;
peers[npeers].write_fd = START_DATA_FD;
peers[npeers].type = PEER_FILE;
peers[npeers].seq = 0;