Updated through tag hostap_2_5 from git://w1.fi/hostap.git
[mech_eap.git] / libeap / src / eap_peer / eap_methods.c
index 3b0af05..1bdd81e 100644 (file)
@@ -2,14 +2,8 @@
  * EAP peer: Method registration
  * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Alternatively, this software may be distributed under the terms of BSD
- * license.
- *
- * See README and COPYING for more details.
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
  */
 
 #include "includes.h"
@@ -77,6 +71,8 @@ EapType eap_peer_get_type(const char *name, int *vendor)
 const char * eap_get_name(int vendor, EapType type)
 {
        struct eap_method *m;
+       if (vendor == EAP_VENDOR_IETF && type == EAP_TYPE_EXPANDED)
+               return "expanded";
        for (m = eap_methods; m; m = m->next) {
                if (m->vendor == vendor && m->method == type)
                        return m->name;
@@ -107,7 +103,7 @@ size_t eap_get_names(char *buf, size_t buflen)
        for (m = eap_methods; m; m = m->next) {
                ret = os_snprintf(pos, end - pos, "%s%s",
                                  m == eap_methods ? "" : " ", m->name);
-               if (ret < 0 || ret >= end - pos)
+               if (os_snprintf_error(end - pos, ret))
                        break;
                pos += ret;
        }
@@ -137,7 +133,7 @@ char ** eap_get_names_as_string_array(size_t *num)
        for (m = eap_methods; m; m = m->next)
                array_len++;
 
-       array = os_zalloc(sizeof(char *) * (array_len + 1));
+       array = os_calloc(array_len + 1, sizeof(char *));
        if (array == NULL)
                return NULL;