avoid talloc abort in simtrace2 frontend_append_script_env()

talloc requires a valid context for the allocation, we cannot use
env[i] as context.

Change-Id: I82b5e6b91b39d6f5c2a7492adb8c6193083e0d70
changes/37/18437/1
Harald Welte 3 years ago
parent 5c860acbb5
commit e580c93169
  1. 2
      src/client/client.h
  2. 4
      src/client/main_fsm.c
  3. 4
      src/client/user_ifdhandler.c
  4. 4
      src/client/user_shell.c
  5. 3
      src/client/user_simtrace2.c

@ -48,7 +48,7 @@ int frontend_request_modem_reset(struct bankd_client *bc);
int frontend_handle_card2modem(struct bankd_client *bc, const uint8_t *data, size_t len);
int frontend_handle_set_atr(struct bankd_client *bc, const uint8_t *data, size_t len);
int frontend_handle_slot_status(struct bankd_client *bc, const SlotPhysStatus_t *sts);
int frontend_append_script_env(struct bankd_client *bc, char **env, size_t max_env);
int frontend_append_script_env(struct bankd_client *bc, char **env, int idx, size_t max_env);
/* main.c */

@ -75,9 +75,9 @@ static char **build_script_env(struct bankd_client *bc, const char *cause)
env[i++] = talloc_asprintf(env, "REMSIM_CAUSE=%s", cause);
/* ask frontend to append any frontend-speccific additional environment vars */
rc = frontend_append_script_env(bc, env+i, 256-i);
rc = frontend_append_script_env(bc, env, i, 256-i-1);
if (rc > 0)
i += rc;
i = rc;
/* terminate last entry */
env[i++] = NULL;

@ -206,9 +206,9 @@ int frontend_handle_slot_status(struct bankd_client *bc, const SlotPhysStatus_t
return 0;
}
int frontend_append_script_env(struct bankd_client *bc, char **env, size_t max_env)
int frontend_append_script_env(struct bankd_client *bc, char **env, int idx, size_t max_env)
{
return 0;
return idx;
}
/***********************************************************************

@ -54,9 +54,9 @@ int frontend_handle_slot_status(struct bankd_client *bc, const SlotPhysStatus_t
return 0;
}
int frontend_append_script_env(struct bankd_client *bc, char **env, size_t max_env)
int frontend_append_script_env(struct bankd_client *bc, char **env, int idx, size_t max_env)
{
return 0;
return idx;
}

@ -361,10 +361,9 @@ int frontend_handle_slot_status(struct bankd_client *bc, const SlotPhysStatus_t
return 0;
}
int frontend_append_script_env(struct bankd_client *bc, char **env, size_t max_env)
int frontend_append_script_env(struct bankd_client *bc, char **env, int i, size_t max_env)
{
struct osmo_st2_cardem_inst *ci = bc->cardem;
int i = 0;
if (max_env < 4)
return -ENOSPC;

Loading…
Cancel
Save