michal-grzedzicki / rpms / rpm

Forked from rpms/rpm 5 months ago
Clone
Blob Blame History Raw
From 3372e6c917e54b3a84c04ca4274000da04a98e86 Mon Sep 17 00:00:00 2001
From: chantra <chantr4@gmail.com>
Date: Thu, 17 Feb 2022 08:54:47 -0800
Subject: [PATCH 26/30] fix integer underflow in vfyFDCb

---
 lib/rpmchecksig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c
index 5e8794e2d..7ad4e7034 100644
--- a/lib/rpmchecksig.c
+++ b/lib/rpmchecksig.c
@@ -345,7 +345,7 @@ static int vfyFDCb(struct rpmsinfo_s *sinfo, void *cbdata)
     struct vfydatafd_s *vd = cbdata;
     char *vmsg, *msg;
     size_t n;
-    size_t remainder = BUFSIZ - vd->len;
+    size_t remainder = BUFSIZ - vd->len >= 0 ? BUFSIZ - vd->len : 0;
 
     vmsg = rpmsinfoMsg(sinfo);
     rasprintf(&msg, "    %s\n", vmsg);
-- 
2.35.1