gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-merchant] 02/04: avoid undefined behavior


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] 02/04: avoid undefined behavior
Date: Wed, 04 Apr 2018 17:51:30 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to annotated tag v0.5.0
in repository merchant.

commit 9f7fda4cd95c1a61a076d521ec9fc9664169dc5c
Author: Florian Dold <address@hidden>
AuthorDate: Wed Apr 4 17:28:57 2018 +0200

    avoid undefined behavior
---
 src/lib/merchant_api_pay.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lib/merchant_api_pay.c b/src/lib/merchant_api_pay.c
index 75c2384..b0a2f0e 100644
--- a/src/lib/merchant_api_pay.c
+++ b/src/lib/merchant_api_pay.c
@@ -132,7 +132,9 @@ check_abort_refund (struct TALER_MERCHANT_Pay *ph,
   }
   num_refunds = json_array_size (refunds);
   {
-    struct TALER_MERCHANT_RefundEntry res[num_refunds];
+    /* The "+ 1" is necessary since num_refunds might be 0, and variable size 
arrays must
+     * be >0, or it's undefined behavior */
+    struct TALER_MERCHANT_RefundEntry res[num_refunds + 1];
 
     for (unsigned int i=0;i<num_refunds;i++)
     {

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]