summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2011-02-10 19:37:56 -0500
committerJason A. Donenfeld <Jason@zx2c4.com>2011-02-10 19:37:56 -0500
commitc0f81ca42b125d9a8d9c334eeec74fa5487bfc15 (patch)
treebdab491e1cc2960055b23970db9f6ff0fdca324e
parentAccept output file and write error messages to stderr. (diff)
downloadlastlog-c0f81ca42b125d9a8d9c334eeec74fa5487bfc15.tar.xz
lastlog-c0f81ca42b125d9a8d9c334eeec74fa5487bfc15.zip
Make sure we don't write too much into ip string.
-rw-r--r--utmpr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/utmpr.c b/utmpr.c
index 0e04939..9f87b01 100644
--- a/utmpr.c
+++ b/utmpr.c
@@ -131,7 +131,7 @@ void binary_to_text(FILE *fp)
if (0) //TODO: determine how to figure out of it's an ipv6. entries 1 2 and 3 are zero perhaps?
ip[0] = 'a'; //TODO: format ipv6 address
else
- sprintf(ip, "%d.%d.%d.%d",
+ sprintf(ip, "%hhu.%hhu.%hhu.%hhu",
(entry.ut_addr_v6[0] >> 0x0) & 0xFF,
(entry.ut_addr_v6[0] >> 0x8) & 0xFF,
(entry.ut_addr_v6[0] >> 0x10) & 0xFF,