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

[Security report]: Patch for CVE-2020-26243 & CVE-2020-5235 found in reused component nanopb by using V1SCAN #6312

Open
ltcdCai opened this issue Jul 23, 2024 · 1 comment

Comments

@ltcdCai
Copy link

ltcdCai commented Jul 23, 2024

Contact me:
[email protected]

References:

Github Security Advisory for CVE-2020-26243
NVD description
Commit for CVE-2020-26243

Steps to reproduce it

Patch suggestion:
Replace the code at lines 406-415 with the following code:

            if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE &&
                *(pb_size_t*)iter->pSize != iter->pos->tag)
            {
                /* We memset to zero so that any callbacks are set to NULL.
                 * This is because the callbacks might otherwise have values
                 * from some other union field. */
                memset(iter->pData, 0, iter->pos->data_size);
                pb_message_set_to_defaults((const pb_field_t*)iter->pos->ptr, iter->pData);
            }
            *(pb_size_t*)iter->pSize = iter->pos->tag;

            return func(stream, iter->pos, iter->pData);

Github Security Advisory for CVE-2020-5235
NVD description
Commit for CVE-2020-5235

Patch suggestion:
Replace the code at lines 658-662 with the following code:

                if (!allocate_field(stream, iter->pData, iter->pos->data_size, (size_t)(*size + 1)))
                    return false;
            
                pItem = *(char**)iter->pData + iter->pos->data_size * (*size);
                (*size)++;
@sunghan-chang
Copy link
Contributor

@jylee9613 Could you check it?

@ltcdCai ltcdCai changed the title [Security report]: Patch for CVE-2020-26243 found in reused component nanopb by using V1SCAN [Security report]: Patch for CVE-2020-26243 & CVE-2020-5235 found in reused component nanopb by using V1SCAN Oct 8, 2024
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

No branches or pull requests

2 participants