Skip to content

Commit 7d9d2e8

Browse files
committed
Updated code examples in README for CWE-175
Signed-off-by: edanhub <[email protected]>
1 parent 45033c8 commit 7d9d2e8

File tree

1 file changed

+12
-2
lines changed
  • docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175

1 file changed

+12
-2
lines changed

docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,24 @@ def compare_number(number):
155155

156156

157157
print(f"Locale is {locale.getlocale()}")
158-
159158
print(f"Do the numbers match? {compare_number(ORIGINAL_NUMBER)}")
160159

161-
# Setting the locale to German
160+
# Console output:
161+
# Locale is ('English_Ireland', '1252')
162+
# Enter a number: 12,345
163+
# Do the numbers match? False
164+
165+
# After setting the locale
166+
162167
locale.setlocale(locale.LC_ALL, 'de_DE.utf8')
163168
print(f"Locale is {locale.getlocale()}")
164169
print(f"Do the numbers match? {compare_number(ORIGINAL_NUMBER)}")
165170

171+
# Console output:
172+
# Locale is ('de_DE', 'UTF-8')
173+
# Enter a number: 12,345
174+
# Do the numbers match? True
175+
166176
```
167177

168178
## Non-Compliant Code Example (Encoding)

0 commit comments

Comments
 (0)