aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2023-06-25 16:41:00 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2023-06-25 16:41:00 +0200
commit4b3ff0e1e18c2bba72e36dcc97c50cf50fcdb9a1 (patch)
tree66f036fdc3d009b875386b6850a2f0413733dbbb /src
parent3c47c0ae92ec5ec93075fb44caa412a54996351e (diff)
downloadgnunet-4b3ff0e1e18c2bba72e36dcc97c50cf50fcdb9a1.tar.gz
gnunet-4b3ff0e1e18c2bba72e36dcc97c50cf50fcdb9a1.zip
proper overflow check
Diffstat (limited to 'src')
-rw-r--r--src/pq/pq_query_helper.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c
index 932f3cb0b..2293c8005 100644
--- a/src/pq/pq_query_helper.c
+++ b/src/pq/pq_query_helper.c
@@ -689,7 +689,7 @@ qconv_array (
689 /* num * length-field */ 689 /* num * length-field */
690 size_t x = sizeof(uint32_t); 690 size_t x = sizeof(uint32_t);
691 size_t y = x * num; 691 size_t y = x * num;
692 RETURN_UNLESS (y >= num); 692 RETURN_UNLESS ((0 == num) || (y / num == x));
693 693
694 /* size of header */ 694 /* size of header */
695 total_size = x = sizeof(struct pq_array_header); 695 total_size = x = sizeof(struct pq_array_header);
@@ -700,11 +700,11 @@ qconv_array (
700 if (same_sized) 700 if (same_sized)
701 { 701 {
702 x = num * meta->same_size; 702 x = num * meta->same_size;
703 RETURN_UNLESS (x >= num); 703 RETURN_UNLESS ((0 == num) || (x / num == meta->same_size));
704 704
705 y = total_size; 705 y = total_size;
706 total_size += x; 706 total_size += x;
707 RETURN_UNLESS ((total_size >= y)); 707 RETURN_UNLESS (total_size >= y);
708 } 708 }
709 else /* sizes are different per element */ 709 else /* sizes are different per element */
710 { 710 {