summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>2000-09-21 01:34:20 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>2000-09-21 01:34:20 +0000
commitd3c7e021c17b20c81c3df6becc26565256265d7a (patch)
tree5951ae37ddc95dddcfd35353eb169743340da434 /sbin
parentac99bb10d7e72662fbc16784df462745129a1fcc (diff)
Allocate memory for srcid/dstid.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ipsecadm/ipsecadm.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/sbin/ipsecadm/ipsecadm.c b/sbin/ipsecadm/ipsecadm.c
index 73082df331d..6eb456f190b 100644
--- a/sbin/ipsecadm/ipsecadm.c
+++ b/sbin/ipsecadm/ipsecadm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsecadm.c,v 1.41 2000/09/20 21:28:23 angelos Exp $ */
+/* $OpenBSD: ipsecadm.c,v 1.42 2000/09/21 01:34:19 angelos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -864,7 +864,13 @@ main(int argc, char **argv)
exit(1);
}
- srcid = argv[i + 1];
+ srcid = calloc(ROUNDUP(strlen(argv[i + 1])), sizeof(char));
+ if (srcid == NULL)
+ {
+ fprintf(stderr, "%s: malloc failed\n", argv[0]);
+ exit(1);
+ }
+ strcpy(srcid, argv[i + 1]);
sid1.sadb_ident_len += ROUNDUP(strlen(srcid)) / sizeof(u_int64_t);
i++;
continue;
@@ -880,7 +886,13 @@ main(int argc, char **argv)
exit(1);
}
- dstid = argv[i + 1];
+ dstid = calloc(ROUNDUP(strlen(argv[i + 1])), sizeof(char));
+ if (dstid == NULL)
+ {
+ fprintf(stderr, "%s: malloc failed\n", argv[0]);
+ exit(1);
+ }
+ strcpy(dstid, argv[i + 1]);
sid2.sadb_ident_len += ROUNDUP(strlen(dstid)) / sizeof(u_int64_t);
i++;
continue;