summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorniklas <niklas@openbsd.org>1999-06-05 18:01:28 +0000
committerniklas <niklas@openbsd.org>1999-06-05 18:01:28 +0000
commit19d1633681a009a6ec66bab108afeaa3005dbf70 (patch)
treee4b2107e76bad585cd65356374c4959b0c13088b
parentuse inet_aton() (diff)
downloadwireguard-openbsd-19d1633681a009a6ec66bab108afeaa3005dbf70.tar.xz
wireguard-openbsd-19d1633681a009a6ec66bab108afeaa3005dbf70.zip
Merge with EOM 1.27
author: niklas style author: niklas strdup error checking
-rw-r--r--sbin/isakmpd/asn.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sbin/isakmpd/asn.c b/sbin/isakmpd/asn.c
index 10437e34060..68d7c2826ca 100644
--- a/sbin/isakmpd/asn.c
+++ b/sbin/isakmpd/asn.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: asn.c,v 1.7 1999/04/19 20:56:57 niklas Exp $ */
-/* $EOM: asn.c,v 1.25 1999/04/18 15:17:22 niklas Exp $ */
+/* $OpenBSD: asn.c,v 1.8 1999/06/05 18:01:28 niklas Exp $ */
+/* $EOM: asn.c,v 1.27 1999/06/05 18:02:38 niklas Exp $ */
/*
* Copyright (c) 1998 Niels Provos. All rights reserved.
@@ -214,9 +214,9 @@ asn_parse_objectid (struct asn_objectid *table, char *id)
while (table->name)
{
- if (!strcmp (table->objectid, id))
+ if (strcmp (table->objectid, id) == 0)
return table->name;
- if (!strncmp (table->objectid, id, strlen (table->objectid))
+ if (strncmp (table->objectid, id, strlen (table->objectid) == 0)
&& strlen (table->objectid) > len)
{
len = strlen (table->objectid);
@@ -244,10 +244,16 @@ asn_decompose (char *path, struct norm_type *obj)
char *p, *p2, *tmp;
int counter;
- if (!strcasecmp (path, obj->name))
- return obj->data;
+ if (strcasecmp (path, obj->name) == 0)
+ return obj->data;
- p = path = strdup (path);
+ p = strdup (path);
+ if (!p)
+ {
+ log_error ("asn_decompose: strdup(\"%s\") failed", path);
+ return 0;
+ }
+ path = p;
p2 = strsep (&p, ".");
if (strcasecmp (p2, obj->name) || !p)
@@ -268,7 +274,7 @@ asn_decompose (char *path, struct norm_type *obj)
tmp = strchr (p2, '[');
if (tmp)
{
- counter = atoi (tmp+1);
+ counter = atoi (tmp + 1);
*tmp = 0;
}
else
@@ -277,7 +283,7 @@ asn_decompose (char *path, struct norm_type *obj)
/* Find the tag. */
while (obj->type != TAG_STOP)
{
- if (!strcasecmp (p2, obj->name) && counter-- == 0)
+ if (strcasecmp (p2, obj->name) == 0 && counter-- == 0)
break;
obj++;
}