Commit 5ceca4fd authored by npzacs's avatar npzacs Committed by hpi1

keydbcfg: Add missing error checks (invalid hexstring)

parent 58fb6beb
...@@ -168,9 +168,10 @@ static int _parse_pk_file(config_file *cf, AACS_FILE_H *fp) ...@@ -168,9 +168,10 @@ static int _parse_pk_file(config_file *cf, AACS_FILE_H *fp)
pk_list *e = calloc(1, sizeof(pk_list)); pk_list *e = calloc(1, sizeof(pk_list));
if (e) { if (e) {
hexstring_to_hex_array(e->key, 16, str); if (!hexstring_to_hex_array(e->key, 16, str)) {
BD_DEBUG(DBG_FILE, "Skipping invalid processing key %s\n", str);
if (_is_duplicate_pk(cf->pkl, e->key)) { X_FREE(e);
} else if (_is_duplicate_pk(cf->pkl, e->key)) {
BD_DEBUG(DBG_FILE, "Skipping duplicate processing key %s\n", str); BD_DEBUG(DBG_FILE, "Skipping duplicate processing key %s\n", str);
X_FREE(e); X_FREE(e);
} else { } else {
...@@ -229,10 +230,11 @@ static int _parse_cert_file(config_file *cf, AACS_FILE_H *fp) ...@@ -229,10 +230,11 @@ static int _parse_cert_file(config_file *cf, AACS_FILE_H *fp)
cert_list *e = calloc(1, sizeof(cert_list)); cert_list *e = calloc(1, sizeof(cert_list));
if (e) { if (e) {
hexstring_to_hex_array(e->host_priv_key, 20, host_priv_key); if (!hexstring_to_hex_array(e->host_priv_key, 20, host_priv_key) ||
hexstring_to_hex_array(e->host_cert, 92, host_cert); !hexstring_to_hex_array(e->host_cert, 92, host_cert)) {
BD_DEBUG(DBG_FILE, "Skipping invalid certificate entry %s %s\n", host_priv_key, host_cert);
if (_is_duplicate_cert(cf->host_cert_list, e)) { X_FREE(e);
} else if (_is_duplicate_cert(cf->host_cert_list, e)) {
BD_DEBUG(DBG_FILE, "Skipping duplicate certificate entry %s %s\n", host_priv_key, host_cert); BD_DEBUG(DBG_FILE, "Skipping duplicate certificate entry %s %s\n", host_priv_key, host_cert);
X_FREE(e); X_FREE(e);
} else { } else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment