Skip to content

Commit

Permalink
change env_value to string
Browse files Browse the repository at this point in the history
  • Loading branch information
estkme committed Nov 23, 2023
1 parent 66bd3b1 commit 760da11
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion interface/apdu/pcsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,17 +380,29 @@ static int pcsc_list_iter(int index, const char *reader, void *userdata)
cJSON *json = userdata;
cJSON *jreader;

char *index_str;

jreader = cJSON_CreateObject();
if (!jreader)
{
return -1;
}

if (!cJSON_AddNumberToObject(jreader, "env_value", index))
index_str = malloc(16);
if (!index_str)
{
return -1;
}

snprintf(index_str, 16, "%d", index);

if (!cJSON_AddStringToObject(jreader, "env", index_str))
{
return -1;
}

free(index_str);

if (!cJSON_AddStringToObject(jreader, "name", reader))
{
return -1;
Expand Down

0 comments on commit 760da11

Please sign in to comment.