summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoritz <>2005-03-06 16:17:23 +0000
committermoritz <>2005-03-06 16:17:23 +0000
commitc3616a88a1b51df92c875fce2f3b84f5eb715e9b (patch)
tree0c36ef483651d6faf4499d8dcb9dc339fa8a6707
parent18f99099dd31a01947a7da4b729ea4d7ec7e79b1 (diff)
downloadopenbsd-c3616a88a1b51df92c875fce2f3b84f5eb715e9b.tar.gz
openbsd-c3616a88a1b51df92c875fce2f3b84f5eb715e9b.tar.bz2
openbsd-c3616a88a1b51df92c875fce2f3b84f5eb715e9b.zip
correct snprintf return value checks, where the wrong ptr
was used for calculating the buffer size. ok tedu@ cloder@
-rw-r--r--src/lib/libc/net/res_debug.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/libc/net/res_debug.c b/src/lib/libc/net/res_debug.c
index 8f66c7d009..e0f2a89418 100644
--- a/src/lib/libc/net/res_debug.c
+++ b/src/lib/libc/net/res_debug.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: res_debug.c,v 1.17 2003/06/02 20:18:36 millert Exp $ */ 1/* $OpenBSD: res_debug.c,v 1.18 2005/03/06 16:17:23 moritz Exp $ */
2 2
3/* 3/*
4 * ++Copyright++ 1985, 1990, 1993 4 * ++Copyright++ 1985, 1990, 1993
@@ -78,7 +78,7 @@
78static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93"; 78static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
79static char rcsid[] = "$From: res_debug.c,v 8.19 1996/11/26 10:11:23 vixie Exp $"; 79static char rcsid[] = "$From: res_debug.c,v 8.19 1996/11/26 10:11:23 vixie Exp $";
80#else 80#else
81static char rcsid[] = "$OpenBSD: res_debug.c,v 1.17 2003/06/02 20:18:36 millert Exp $"; 81static char rcsid[] = "$OpenBSD: res_debug.c,v 1.18 2005/03/06 16:17:23 moritz Exp $";
82#endif 82#endif
83#endif /* LIBC_SCCS and not lint */ 83#endif /* LIBC_SCCS and not lint */
84 84
@@ -1075,7 +1075,7 @@ p_time(value)
1075 ebuf = nbuf + sizeof(nbuf); 1075 ebuf = nbuf + sizeof(nbuf);
1076 if (days) { 1076 if (days) {
1077 if ((tmp = snprintf(p, ebuf - p, "%d day%s", 1077 if ((tmp = snprintf(p, ebuf - p, "%d day%s",
1078 PLURALIZE(days))) >= ebuf - nbuf || tmp < 0) 1078 PLURALIZE(days))) >= ebuf - p || tmp < 0)
1079 goto full; 1079 goto full;
1080 p += tmp; 1080 p += tmp;
1081 } 1081 }
@@ -1085,7 +1085,7 @@ p_time(value)
1085 if (p >= ebuf) 1085 if (p >= ebuf)
1086 goto full; 1086 goto full;
1087 if ((tmp = snprintf(p, ebuf - p, "%d hour%s", 1087 if ((tmp = snprintf(p, ebuf - p, "%d hour%s",
1088 PLURALIZE(hours))) >= ebuf - nbuf || tmp < 0) 1088 PLURALIZE(hours))) >= ebuf - p || tmp < 0)
1089 goto full; 1089 goto full;
1090 p += tmp; 1090 p += tmp;
1091 } 1091 }
@@ -1095,7 +1095,7 @@ p_time(value)
1095 if (p >= ebuf) 1095 if (p >= ebuf)
1096 goto full; 1096 goto full;
1097 if ((tmp = snprintf(p, ebuf - p, "%d min%s", 1097 if ((tmp = snprintf(p, ebuf - p, "%d min%s",
1098 PLURALIZE(mins))) >= ebuf - nbuf || tmp < 0) 1098 PLURALIZE(mins))) >= ebuf - p || tmp < 0)
1099 goto full; 1099 goto full;
1100 p += tmp; 1100 p += tmp;
1101 } 1101 }
@@ -1105,7 +1105,7 @@ p_time(value)
1105 if (p >= ebuf) 1105 if (p >= ebuf)
1106 goto full; 1106 goto full;
1107 if ((tmp = snprintf(p, ebuf - p, "%d sec%s", 1107 if ((tmp = snprintf(p, ebuf - p, "%d sec%s",
1108 PLURALIZE(secs))) >= ebuf - nbuf || tmp < 0) 1108 PLURALIZE(secs))) >= ebuf - p || tmp < 0)
1109 goto full; 1109 goto full;
1110 } 1110 }
1111 return (nbuf); 1111 return (nbuf);