reg_in->final_challenge = fc_json;
int auth_idx_int = -1;
- sscanf(matched_auth->auth_index, "%d", &auth_idx_int);
+ char *end;
+ long sl;
+
+ sl = strtol(matched_auth->auth_index, &end, 10);
+ if (end == matched_auth->auth_index) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else if ('\0' != *end) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else if ((LONG_MIN == sl || LONG_MAX == sl) && ERANGE == errno) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else if (sl > INT_MAX) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else if (sl < INT_MIN) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else {
+ auth_idx_int = (int)sl;
+ }
reg_in->attestation_type = matched_auth->att_type;
_fido_asm_auth_in_t *auth_asm_in = (_fido_asm_auth_in_t*)calloc(1, sizeof(_fido_asm_auth_in_t));
+ _fido_asm_reg_in_t *reg_in = (_fido_asm_reg_in_t*) calloc(1, sizeof(_fido_asm_reg_in_t));
+
if (cb_data->uaf_req->header->app_id == NULL) {
if (cb_data->uaf_req->facet_id == NULL) {
version->minor = _VERSION_MINOR;
int auth_idx_int = -1;
- sscanf(matched_auth->auth_index, "%d", &auth_idx_int);
+ char *end;
+ long sl;
+
+ sl = strtol(matched_auth->auth_index, &end, 10);
+ if (end == matched_auth->auth_index) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else if ('\0' != *end) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else if ((LONG_MIN == sl || LONG_MAX == sl) && ERANGE == errno) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else if (sl > INT_MAX) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else if (sl < INT_MIN) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else {
+ auth_idx_int = (int)sl;
+ }
+
if (auth_idx_int == -1) {
_ERR("ASM in data missing");
_send_process_response(cb_data, FIDO_ERROR_NO_SUITABLE_AUTHENTICATOR, NULL);
_matched_auth_dereg_t *dereg_data = (_matched_auth_dereg_t*)(g_queue_pop_head(q));
+ _fido_asm_reg_in_t *reg_in = (_fido_asm_reg_in_t*) calloc(1, sizeof(_fido_asm_reg_in_t));
+
char *asm_req_json = NULL;
int auth_index_int = _INVALID_INT;
- sscanf(dereg_data->auth_index, "%d", &auth_index_int);
+ char *end;
+ long sl;
+
+ sl = strtol(dereg_data->auth_index, &end, 10);
+ if (end == dereg_data->auth_index) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else if ('\0' != *end) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else if ((LONG_MIN == sl || LONG_MAX == sl) && ERANGE == errno) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else if (sl > INT_MAX) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else if (sl < INT_MIN) {
+ _ERR("Failed to compose final challenge");
+ _send_process_response(cb_data, FIDO_ERROR_PROTOCOL_ERROR, NULL);
+ _free_fido_asm_reg_in(reg_in);
+ return;
+ } else {
+ auth_index_int = (int)sl;
+ }
_INFO("Auth index for dereg req = [%d]", auth_index_int);