summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--openbsd-compat/inet_ntop.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 8fea9bd89..39510264a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
2 - (djm) Pull in auth-krb5.c from OpenBSD CVS. NB. it is not currently used. 2 - (djm) Pull in auth-krb5.c from OpenBSD CVS. NB. it is not currently used.
3 - (djm) Sync $sysconfdir/moduli 3 - (djm) Sync $sysconfdir/moduli
4 - (djm) Add AC_SYS_LARGEFILE configure test 4 - (djm) Add AC_SYS_LARGEFILE configure test
5 - (djm) Avoid bad and unportable sprintf usage in compat code
5 6
620010923 720010923
7 - (bal) updated ssh.c to mirror minor getopts 'extern int' formating done 8 - (bal) updated ssh.c to mirror minor getopts 'extern int' formating done
@@ -6568,4 +6569,4 @@
6568 - Wrote replacements for strlcpy and mkdtemp 6569 - Wrote replacements for strlcpy and mkdtemp
6569 - Released 1.0pre1 6570 - Released 1.0pre1
6570 6571
6571$Id: ChangeLog,v 1.1562 2001/09/25 06:39:35 djm Exp $ 6572$Id: ChangeLog,v 1.1563 2001/09/25 12:21:52 djm Exp $
diff --git a/openbsd-compat/inet_ntop.c b/openbsd-compat/inet_ntop.c
index bf3d97ade..2b8d31f8d 100644
--- a/openbsd-compat/inet_ntop.c
+++ b/openbsd-compat/inet_ntop.c
@@ -104,7 +104,8 @@ inet_ntop4(src, dst, size)
104 static const char fmt[] = "%u.%u.%u.%u"; 104 static const char fmt[] = "%u.%u.%u.%u";
105 char tmp[sizeof "255.255.255.255"]; 105 char tmp[sizeof "255.255.255.255"];
106 106
107 if (sprintf(tmp, fmt, src[0], src[1], src[2], src[3]) > size) { 107 if (snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2],
108 src[3]) > size) {
108 errno = ENOSPC; 109 errno = ENOSPC;
109 return (NULL); 110 return (NULL);
110 } 111 }
@@ -190,7 +191,8 @@ inet_ntop6(src, dst, size)
190 tp += strlen(tp); 191 tp += strlen(tp);
191 break; 192 break;
192 } 193 }
193 tp += sprintf(tp, "%x", words[i]); 194 snprintf(tp, sizeof(tmp - (tp - tmp)), "%x", words[i]);
195 tp += strlen(tp);
194 } 196 }
195 /* Was it a trailing run of 0x00's? */ 197 /* Was it a trailing run of 0x00's? */
196 if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) 198 if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ))