[PATCH] gssd:fix the possible buffer overflow in get_full_hostname

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

 



From: zhangyaqi <zhangyaqi@xxxxxxxxxx>

Signed-off-by: zhangyaqi <zhangyaqi@xxxxxxxxxx>
---
 utils/gssd/krb5_util.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index 560e8be1..09625fb9 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -619,6 +619,7 @@ get_full_hostname(const char *inhost, char *outhost, int outhostlen)
 		goto out;
 	}
 	strncpy(outhost, addrs->ai_canonname, outhostlen);
+	outhost[outhostlen - 1] = '\0';
 	nfs_freeaddrinfo(addrs);
 	for (c = outhost; *c != '\0'; c++)
 	    *c = tolower(*c);
-- 
2.27.0





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux