CVE-2020-29203
Description
struct2json before 2020-11-18 is affected by a Buffer Overflow because strcpy is used for S2J_STRUCT_GET_string_ELEMENT.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
A buffer overflow vulnerability in struct2json before 2020-11-18 allows attackers to cause a denial of service or potentially execute arbitrary code via a crafted JSON string.
Vulnerability
The struct2json library prior to the 2020-11-18 commit contains a buffer overflow vulnerability in the S2J_STRUCT_GET_string_ELEMENT macro. This macro uses strcpy to copy a JSON string value into a struct member array, without checking the length of the source string against the destination buffer size [1]. When the JSON string exceeds the allocated array size, a buffer overflow occurs.
Exploitation
An attacker can exploit this vulnerability by supplying a JSON object with a string value longer than the corresponding struct array field. The overflow is triggered during deserialization when s2j_struct_get_basic_element is called for string elements [1]. No authentication or special privileges are required; the attack can be performed remotely if the application processes untrusted JSON input.
Impact
Successful exploitation results in memory corruption, potentially leading to a denial of service (crash) or arbitrary code execution. The severity depends on the memory layout and the struct's location [1].
Mitigation
The vulnerability is fixed by replacing strcpy with strncpy to limit the copy length to the destination buffer size [1]. Users should update to the patched version (after 2020-11-18) or apply the provided fix to the S2J_STRUCT_GET_string_ELEMENT macro. No workaround is available other than avoiding untrusted JSON input.
AI Insight generated on May 26, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
2- struct2json/struct2jsondescription
- Range: <2020-11-18
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
1- github.com/armink/struct2json/issues/13mitrex_refsource_MISC
News mentions
0No linked articles in our index yet.