aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-05-09 13:24:53 +0200
committerChristian Grothoff <christian@grothoff.org>2017-05-09 13:24:53 +0200
commit783642272d83fae148edfd308c86b157c3e4a6d4 (patch)
tree89e570ab688c0c605ceffb44c591062c92463874 /src
parentb53c189e0a0d53df325cb9abeaaa515fa3414c18 (diff)
fix possible NULL deref, simplify logic
Diffstat (limited to 'src')
-rw-r--r--src/bank-lib/fakebank.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index f8edd082d..0359b4a4b 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -476,20 +476,15 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
}
else
{
- if (NULL == h->transactions_head)
- {
- GNUNET_break (0);
- return MHD_NO;
- }
for (pos = h->transactions_head;
- pos->serial_id != start_number;
+ NULL != pos;
pos = pos->next)
+ if (pos->serial_id == start_number)
+ break;
+ if (NULL == pos)
{
- if (NULL == pos)
- {
- GNUNET_break (0);
- return MHD_NO;
- }
+ GNUNET_break (0);
+ return MHD_NO;
}
/* range is exclusive, skip the matching entry */
if (count > 0)