diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1999-06-05 18:01:29 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1999-06-05 18:01:29 +0000 |
commit | 91dac5911e58f422d2bfadd861f43f77c32e6a28 (patch) | |
tree | 357a63c83a7855738aa572e8e110be51315f27df /sbin | |
parent | 97225cea46148f9eb52f3b752fa13427dd50e89d (diff) |
Merge with EOM 1.27
author: niklas
style
author: niklas
strdup error checking
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/isakmpd/asn.c | 24 |
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++; } |