Sync up nameser with upstream(2014.03.05)
Bug: 13219633
Change-Id: I8ee4ddf270710e9eea415fa3db984af7719a8dd4
diff --git a/libc/dns/nameser/ns_ttl.c b/libc/dns/nameser/ns_ttl.c
index 1ad3b49..2395b99 100644
--- a/libc/dns/nameser/ns_ttl.c
+++ b/libc/dns/nameser/ns_ttl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ns_ttl.c,v 1.2 2004/05/20 20:35:05 christos Exp $ */
+/* $NetBSD: ns_ttl.c,v 1.8 2012/03/13 21:13:39 christos Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@@ -20,9 +20,9 @@
#include <sys/cdefs.h>
#ifndef lint
#ifdef notdef
-static const char rcsid[] = "Id: ns_ttl.c,v 1.1.206.1 2004/03/09 08:33:45 marka Exp";
+static const char rcsid[] = "Id: ns_ttl.c,v 1.4 2005/07/28 06:51:49 marka Exp";
#else
-__RCSID("$NetBSD: ns_ttl.c,v 1.2 2004/05/20 20:35:05 christos Exp $");
+__RCSID("$NetBSD: ns_ttl.c,v 1.8 2012/03/13 21:13:39 christos Exp $");
#endif
#endif
@@ -30,6 +30,7 @@
#include <arpa/nameser.h>
+#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
@@ -57,11 +58,11 @@
int secs, mins, hours, days, weeks, x;
char *p;
- secs = src % 60; src /= 60;
- mins = src % 60; src /= 60;
- hours = src % 24; src /= 24;
- days = src % 7; src /= 7;
- weeks = src; src = 0;
+ secs = (int)(src % 60); src /= 60;
+ mins = (int)(src % 60); src /= 60;
+ hours = (int)(src % 24); src /= 24;
+ days = (int)(src % 7); src /= 7;
+ weeks = (int)src; src = 0;
x = 0;
if (weeks) {
@@ -93,7 +94,8 @@
*p = tolower(ch);
}
- return (dst - odst);
+ _DIAGASSERT(__type_fit(int, dst - odst));
+ return (int)(dst - odst);
}
#ifndef _LIBC
@@ -137,7 +139,8 @@
goto einval;
else
ttl += tmp;
- }
+ } else if (!dirty)
+ goto einval;
*dst = ttl;
return (0);