Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data value is NULL in v1_secret_t #66

Closed
minerba opened this issue Jul 7, 2021 · 2 comments · Fixed by #68
Closed

Data value is NULL in v1_secret_t #66

minerba opened this issue Jul 7, 2021 · 2 comments · Fixed by #68

Comments

@minerba
Copy link

minerba commented Jul 7, 2021

I called Function CoreV1API_listNamespacedSecret
but I can't see secret's data Info

There is Some Bug in "v1_secret_parserFromJSON"

// v1_secret->data
    cJSON *data = cJSON_GetObjectItemCaseSensitive(v1_secretJSON, "data");
    list_t *dataList;
    if (data) {
    cJSON *data_local_map;
    if(!cJSON_IsObject(data)) {
        goto end;//primitive map container
    }
    dataList = list_create();
    keyValuePair_t *localMapKeyPair;
    cJSON_ArrayForEach(data_local_map, data)
    {
        cJSON *localMapObject = data_local_map;
        list_addElement(dataList , localMapKeyPair);
    }
    }

I think it has to be changed like Below

cJSON *data = cJSON_GetObjectItemCaseSensitive(v1_secretJSON, "data");
    list_t *dataList;
    if (data) {
    cJSON *data_local_map;
    if(!cJSON_IsObject(data)) {
        goto end;//primitive map container
    }
    dataList = list_create();
    keyValuePair_t *localMapKeyPair;
    cJSON_ArrayForEach(data_local_map, data)
    {
        cJSON *localMapObject = data_local_map;
        if(!cJSON_IsString(localMapObject))
        {
            goto end;
        }
        localMapKeyPair = keyValuePair_create(strdup(localMapObject->string), strdup(localMapObject->valuestring));
        list_addElement(dataList , localMapKeyPair);
    }
    }

"localMapKeyPair" have No value, just Declared in scope. But Used in list_addElement(dataList, localMapKeyPair);

so data value is NULL in v1_secret_t.

@minerba minerba changed the title Null in v1_secret_t Data value is NULL in v1_secret_t Jul 7, 2021
@brendandburns
Copy link
Contributor

@minerba we will investigate this and see where the issue is.

@ityuhui
Copy link
Member

ityuhui commented Jul 21, 2021

I begin to investigate this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants