/*
- * $Id: auth.c,v 1.44.2.3.2.9 2004-02-14 00:30:50 didg Exp $
+ * $Id: auth.c,v 1.44.2.3.2.10 2004-02-14 15:47:19 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
}
while (p) {
- strncpy(name + len, p, sizeof(name) - len);
+ strlcpy(name + len, p, sizeof(name) - len);
LOG(log_debug, logtype_afpd, "uam: loading (%s)", name);
/*
if ((stat(name, &st) == 0) && (mod = uam_load(name, p))) {
/*
- * $Id: mangle.c,v 1.16.2.1.2.7 2003-11-03 03:10:01 bfernhomberg Exp $
+ * $Id: mangle.c,v 1.16.2.1.2.8 2004-02-14 15:47:20 didg Exp $
*
* Copyright (c) 2002. Joe Marcus Clarke (marcus@marcuscom.com)
* All Rights Reserved. See COPYRIGHT.
#include <ctype.h>
#include "mangle.h"
#include "desktop.h"
+#include <atalk/util.h>
#define hextoint( c ) ( isdigit( c ) ? c - '0' : c + 10 - 'A' )
#define isuxdigit(x) (isdigit(x) || (isupper(x) && isxdigit(x)))
-
-
static char *demangle_checks ( const struct vol *vol, char* uname, char * mfilename, size_t prefix, char * ext)
{
u_int16_t flags;
}
}
m = mfilename;
- memset(m, 0, MAX_LENGTH + 1);
k = sprintf(mangle_suffix, "%c%X", MANGLE_CHAR, ntohl(id));
- strncpy(m, filename, MAX_LENGTH - k - ext_len);
+ strlcpy(m, filename, MAX_LENGTH - k - ext_len +1);
if (*m == 0) {
strcat(m, "???");
}
/*
- * $Id: ofork.c,v 1.20.6.3 2003-11-01 02:38:09 bfernhomberg Exp $
+ * $Id: ofork.c,v 1.20.6.4 2004-02-14 15:47:20 didg Exp $
*
* Copyright (c) 1996 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include <atalk/logger.h>
#include <errno.h>
-#include <atalk/adouble.h>
+#include <atalk/util.h>
#include "globals.h"
#include "volume.h"
if (vol == of->of_vol && olddir == of->of_dir &&
s_of->key.dev == of->key.dev &&
s_of->key.inode == of->key.inode ) {
- strncpy( of->of_name, newpath, of->of_namelen);
+ strlcpy( of->of_name, newpath, of->of_namelen);
if (newdir != olddir) {
of->of_d_prev->of_d_next = of->of_d_next;
of->of_d_next->of_d_prev = of->of_d_prev;
oforks[ of_refnum ] = NULL;
return NULL;
}
- strncpy( of->of_name, path, of->of_namelen = 255 + 1);
+ strlcpy( of->of_name, path, of->of_namelen = 255 + 1);
*ofrefnum = refnum;
of->of_refnum = refnum;
of->key.dev = st->st_dev;
/*
- * $Id: volume.c,v 1.51.2.7.2.19 2004-02-05 16:55:19 bfernhomberg Exp $
+ * $Id: volume.c,v 1.51.2.7.2.20 2004-02-14 15:47:20 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
if (!ret) {
return NULL;
}
- strncpy(dest, src, destlen);
+ strlcpy(dest, src, destlen +1);
if ((p = strchr(src, '$')) == NULL) /* nothing to do */
return ret;
if (!args)
return -1;
- strncpy(buf, args, sizeof(buf));
+ strlcpy(buf, args, sizeof(buf));
if ((p = strtok(buf, ",")) == NULL) /* nothing, return okay */
return -1;
/*
- * $Id: ad_open.c,v 1.30.6.6 2004-02-06 13:39:52 bfernhomberg Exp $
+ * $Id: ad_open.c,v 1.30.6.7 2004-02-14 15:47:22 didg Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@u.washington.edu)
* Copyright (c) 1990,1991 Regents of The University of Michigan.
* / a/.AppleDouble/b
* a/b
* \ b/.AppleDouble/.Parent
+ *
+ * FIXME: should do something for pathname > MAXPATHLEN
*/
char *
ad_path( path, adflags )
{
static char pathbuf[ MAXPATHLEN + 1];
char c, *slash, buf[MAXPATHLEN + 1];
+ size_t l;
- strncpy(buf, path, MAXPATHLEN);
+ l = strlcpy(buf, path, MAXPATHLEN +1);
if ( adflags & ADFLAGS_DIR ) {
- strncpy( pathbuf, buf, MAXPATHLEN );
- if ( *buf != '\0' ) {
- strcat( pathbuf, "/" );
+ strcpy( pathbuf, buf);
+ if ( *buf != '\0' && l < MAXPATHLEN) {
+ pathbuf[l++] = '/';
+ pathbuf[l] = 0;
}
slash = ".Parent";
} else {
if (NULL != ( slash = strrchr( buf, '/' )) ) {
c = *++slash;
*slash = '\0';
- strncpy( pathbuf, buf, MAXPATHLEN);
+ strcpy( pathbuf, buf);
*slash = c;
} else {
pathbuf[ 0 ] = '\0';
slash = buf;
}
}
- strncat( pathbuf, ".AppleDouble/", MAXPATHLEN - strlen(pathbuf));
- strncat( pathbuf, slash, MAXPATHLEN - strlen(pathbuf));
+ strlcat( pathbuf, ".AppleDouble/", MAXPATHLEN +1);
+ strlcat( pathbuf, slash, MAXPATHLEN +1);
return( pathbuf );
}