Avoid NULL string in printf on EAP method names in authenticator
In ieee802_1x_decapsulate_radius(), eap_server_get_name() may return NULL, and it could be dereferenced depending on printf implementation. Change it to return "unknown" instead for the case of no matching EAP method found. This makes it easier for the callers to simply print this in logs (which is the only use for this function). Signed-off-by: Eytan Lifshitz <eytan.lifshitz@intel.com>
This commit is contained in:
parent
b72b2ad39e
commit
414f23d8b9
2 changed files with 6 additions and 12 deletions
|
@ -153,7 +153,7 @@ void eap_server_unregister_methods(void)
|
|||
* eap_server_get_name - Get EAP method name for the given EAP type
|
||||
* @vendor: EAP Vendor-Id (0 = IETF)
|
||||
* @type: EAP method type
|
||||
* Returns: EAP method name, e.g., TLS, or %NULL if not found
|
||||
* Returns: EAP method name, e.g., TLS, or "unknown" if not found
|
||||
*
|
||||
* This function maps EAP type numbers into EAP type names based on the list of
|
||||
* EAP methods included in the build.
|
||||
|
@ -167,5 +167,5 @@ const char * eap_server_get_name(int vendor, EapType type)
|
|||
if (m->vendor == vendor && m->method == type)
|
||||
return m->name;
|
||||
}
|
||||
return NULL;
|
||||
return "unknown";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue