mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-28 19:21:08 +00:00
Merge pull request #7807 from gilles-peskine-arm/mbedtls_ssl_protocol_version_str-no_array
Fix very high stack usage in SSL debug code
This commit is contained in:
commit
717a83164e
3
ChangeLog.d/ssl_debug_helpers-stack_usage.txt
Normal file
3
ChangeLog.d/ssl_debug_helpers-stack_usage.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Bugfix
|
||||||
|
* Fix very high stack usage in SSL debug code. Reported by Maximilian
|
||||||
|
Gerhardt in #7804.
|
@ -209,24 +209,18 @@ class EnumDefinition:
|
|||||||
continue
|
continue
|
||||||
member = field.strip().split()[0]
|
member = field.strip().split()[0]
|
||||||
translation_table.append(
|
translation_table.append(
|
||||||
'{space}[{member}] = "{member}",'.format(member=member,
|
'{space}case {member}:\n{space} return "{member}";'
|
||||||
space=' '*8)
|
.format(member=member, space=' '*8)
|
||||||
)
|
)
|
||||||
|
|
||||||
body = textwrap.dedent('''\
|
body = textwrap.dedent('''\
|
||||||
const char *{name}_str( {prototype} in )
|
const char *{name}_str( {prototype} in )
|
||||||
{{
|
{{
|
||||||
const char * in_to_str[]=
|
switch (in) {{
|
||||||
{{
|
|
||||||
{translation_table}
|
{translation_table}
|
||||||
}};
|
default:
|
||||||
|
return "UNKNOWN_VALUE";
|
||||||
if( in > ( sizeof( in_to_str )/sizeof( in_to_str[0]) - 1 ) ||
|
|
||||||
in_to_str[ in ] == NULL )
|
|
||||||
{{
|
|
||||||
return "UNKNOWN_VALUE";
|
|
||||||
}}
|
}}
|
||||||
return in_to_str[ in ];
|
|
||||||
}}
|
}}
|
||||||
''')
|
''')
|
||||||
body = body.format(translation_table='\n'.join(translation_table),
|
body = body.format(translation_table='\n'.join(translation_table),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user