1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
From: Carter Yagemann <yagemann@gatech.edu>
Date: Sat, 20 Jun 2020 09:41:24 -0400
Subject: Do not let frmtdbuff overflow in nic_format_buff.
Forwarded: not-needed
Origin: upstream, commit:da1fda491145719ae15dd36dd37a69bdbba0b192
---
src/nwhois.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/nwhois.c b/src/nwhois.c
index 193f953..e54dd5c 100644
--- a/src/nwhois.c
+++ b/src/nwhois.c
@@ -137,6 +137,11 @@ int nic_format_buff(char *buff, int listn)
}
frmtdbuff[strlen(frmtdbuff)] = buff[ctr];
ctr++;
+ if (strlen(frmtdbuff) >= sizeof(frmtdbuff) - 1) {
+ /* frmtdbuff is full, do not let it overflow */
+ print_line("%s", frmtdbuff);
+ memset(frmtdbuff, '\0', sizeof(frmtdbuff));
+ }
}
if ( strlen(frmtdbuff) ) linetodo = 1;
return 0;
|