aboutsummaryrefslogtreecommitdiffstats
path: root/common/t-mapstrings.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-01-06 07:31:38 +0000
committerWerner Koch <[email protected]>2016-01-06 07:31:38 +0000
commit0a00115ee2049ab2357b7a14a51c7da185ffcabd (patch)
tree8ba811680a3ea2a736a8385534127c7ba5676c57 /common/t-mapstrings.c
parentgpg: Align notes about minimal keysize with actual checks. (diff)
downloadgnupg-0a00115ee2049ab2357b7a14a51c7da185ffcabd.tar.gz
gnupg-0a00115ee2049ab2357b7a14a51c7da185ffcabd.zip
common: Do not deref vars in tests after a fail().
* common/t-convert.c (test_bin2hex): Turn if conditions into if-else chains to avoid accessing unchecked data. (test_bin2hexcolon): Ditto. * common/t-mapstrings.c (test_map_static_macro_string): Ditto. * common/t-stringhelp.c (test_percent_escape): Ditto. (test_make_filename_try): Ditto. (test_make_absfilename_try): Ditto. * common/t-timestuff.c (test_timegm): Ditto. -- Note that these dereference only occur after failed regression tests. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'common/t-mapstrings.c')
-rw-r--r--common/t-mapstrings.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/t-mapstrings.c b/common/t-mapstrings.c
index 88c6674bf..8f4c6507b 100644
--- a/common/t-mapstrings.c
+++ b/common/t-mapstrings.c
@@ -68,7 +68,7 @@ test_map_static_macro_string (void)
result = map_static_macro_string (tests[testno].string);
if (!result)
fail (testno);
- if (strcmp (result, tests[testno].expected))
+ else if (strcmp (result, tests[testno].expected))
fail (testno);
if (!tests[testno].lastresult)
tests[testno].lastresult = result;
@@ -80,7 +80,7 @@ test_map_static_macro_string (void)
result = map_static_macro_string (tests[testno].string);
if (!result)
fail (testno);
- if (strcmp (result, tests[testno].expected))
+ else if (strcmp (result, tests[testno].expected))
fail (testno);
if (result != tests[testno].lastresult)
fail (testno);