From: srittau Date: Sat, 10 Nov 2001 18:31:06 +0000 (+0000) Subject: Null-terminate strings after strncpy. X-Git-Tag: netatalk-1-5-rc1~57 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=commitdiff_plain;h=8fff728a295fddc77576470f87c33520841521f5 Null-terminate strings after strncpy. --- diff --git a/etc/afpd/uam.c b/etc/afpd/uam.c index e363905f..d13500f4 100644 --- a/etc/afpd/uam.c +++ b/etc/afpd/uam.c @@ -1,5 +1,5 @@ /* - * $Id: uam.c,v 1.13 2001-09-06 20:00:59 rufustfirefly Exp $ + * $Id: uam.c,v 1.14 2001-11-10 18:31:06 srittau Exp $ * * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu) * All Rights Reserved. See COPYRIGHT. @@ -81,6 +81,7 @@ struct uam_mod *uam_load(const char *path, const char *name) } strncpy(buf, name, sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; if ((p = strchr(buf, '.'))) *p = '\0'; if ((mod->uam_fcn = mod_symbol(module, buf)) == NULL) { @@ -224,6 +225,7 @@ struct passwd *uam_getname(char *name, const int len) if ((strncasecmp(user, name, len) == 0) || (strncasecmp(pwent->pw_name, name, len) == 0)) { strncpy(name, pwent->pw_name, len); + name[len - 1] = '\0'; break; } }