richardphibel / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
2f13d7
From 3372e6c917e54b3a84c04ca4274000da04a98e86 Mon Sep 17 00:00:00 2001
2f13d7
From: chantra <chantr4@gmail.com>
2f13d7
Date: Thu, 17 Feb 2022 08:54:47 -0800
2f13d7
Subject: [PATCH 26/30] fix integer underflow in vfyFDCb
2f13d7
2f13d7
---
2f13d7
 lib/rpmchecksig.c | 2 +-
2f13d7
 1 file changed, 1 insertion(+), 1 deletion(-)
2f13d7
2f13d7
diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c
2f13d7
index 5e8794e2d..7ad4e7034 100644
2f13d7
--- a/lib/rpmchecksig.c
2f13d7
+++ b/lib/rpmchecksig.c
2f13d7
@@ -345,7 +345,7 @@ static int vfyFDCb(struct rpmsinfo_s *sinfo, void *cbdata)
2f13d7
     struct vfydatafd_s *vd = cbdata;
2f13d7
     char *vmsg, *msg;
2f13d7
     size_t n;
2f13d7
-    size_t remainder = BUFSIZ - vd->len;
2f13d7
+    size_t remainder = BUFSIZ - vd->len >= 0 ? BUFSIZ - vd->len : 0;
2f13d7
 
2f13d7
     vmsg = rpmsinfoMsg(sinfo);
2f13d7
     rasprintf(&msg, "    %s\n", vmsg);
2f13d7
-- 
2f13d7
2.35.1
2f13d7