When checking for the length of the user name, check against the size

of the correct field.  Fix provided by Bernhard Moellemann in PR#37137.
This commit is contained in:
he 2007-10-16 15:37:32 +00:00
parent 84a6749ef2
commit 917131a2cf
1 changed files with 2 additions and 2 deletions

View File

@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: ctx.c,v 1.11 2006/05/02 10:09:18 tron Exp $");
__RCSID("$NetBSD: ctx.c,v 1.12 2007/10/16 15:37:32 he Exp $");
#include <sys/param.h>
#include <sys/sysctl.h>
@ -312,7 +312,7 @@ smb_ctx_setserver(struct smb_ctx *ctx, const char *name)
int
smb_ctx_setuser(struct smb_ctx *ctx, const char *name)
{
if (strlen(name) >= sizeof(ctx->ct_ssn.ioc_srvname)) {
if (strlen(name) >= sizeof(ctx->ct_ssn.ioc_user)) {
smb_error("user name '%s' too long", 0, name);
return ENAMETOOLONG;
}