diff options
Diffstat (limited to 'contrib/bind9/lib/bind/dst/support.c')
-rw-r--r-- | contrib/bind9/lib/bind/dst/support.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/contrib/bind9/lib/bind/dst/support.c b/contrib/bind9/lib/bind/dst/support.c index 7b86ea9..8fe3cdb 100644 --- a/contrib/bind9/lib/bind/dst/support.c +++ b/contrib/bind9/lib/bind/dst/support.c @@ -1,4 +1,4 @@ -static const char rcsid[] = "$Header: /proj/cvs/prod/bind9/lib/bind/dst/support.c,v 1.2.2.1 2001/11/02 22:25:29 gson Exp $"; +static const char rcsid[] = "$Header: /proj/cvs/prod/bind9/lib/bind/dst/support.c,v 1.2.2.1.10.2 2005/10/11 00:48:14 marka Exp $"; /* @@ -103,7 +103,7 @@ dst_s_id_calc(const u_char *key, const int keysize) int size = keysize; if (!key || (keysize <= 0)) - return (-1); + return (0xffffU); for (ac = 0; size > 1; size -= 2, kp += 2) ac += ((*kp) << 8) + *(kp + 1); @@ -311,19 +311,15 @@ dst_s_fopen(const char *filename, const char *mode, int perm) { FILE *fp; char pathname[PATH_MAX]; - size_t plen = sizeof(pathname); + + if (strlen(filename) + strlen(dst_path) >= sizeof(pathname)) + return (NULL); if (*dst_path != '\0') { strcpy(pathname, dst_path); - plen -= strlen(pathname); - } - else - pathname[0] = '\0'; - - if (plen > strlen(filename)) - strncpy(&pathname[PATH_MAX - plen], filename, plen-1); - else - return (NULL); + strcat(pathname, filename); + } else + strcpy(pathname, filename); fp = fopen(pathname, mode); if (perm) |