mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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 <wk@gnupg.org>
This commit is contained in:
parent
e70f7a54f2
commit
0a00115ee2
4 changed files with 40 additions and 37 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue