Don't base64 encode the trailing NUL in the HTTP basic auth response.

Problem noted by Eric Haszlakiewicz.
This commit is contained in:
lukem 2004-08-08 13:52:04 +00:00
parent 96e7bb0952
commit d2c6dcc183
2 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fetch.c,v 1.151 2004/07/21 00:09:14 lukem Exp $ */
/* $NetBSD: fetch.c,v 1.152 2004/08/08 13:52:04 lukem Exp $ */
/*-
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fetch.c,v 1.151 2004/07/21 00:09:14 lukem Exp $");
__RCSID("$NetBSD: fetch.c,v 1.152 2004/08/08 13:52:04 lukem Exp $");
#endif /* not lint */
/*
@ -187,7 +187,8 @@ auth_url(const char *challenge, char **response, const char *guser,
*response = (char *)xmalloc(rlen);
(void)strlcpy(*response, scheme, rlen);
len = strlcat(*response, " ", rlen);
base64_encode(clear, clen, (u_char *)*response + len);
/* use `clen - 1' to not encode the trailing NUL */
base64_encode(clear, clen - 1, (u_char *)*response + len);
memset(clear, 0, clen);
rval = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: version.h,v 1.40 2004/07/21 00:09:15 lukem Exp $ */
/* $NetBSD: version.h,v 1.41 2004/08/08 13:52:04 lukem Exp $ */
/*-
* Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
* All rights reserved.
@ -40,5 +40,5 @@
#endif
#ifndef FTP_VERSION
#define FTP_VERSION "20040721"
#define FTP_VERSION "20040808"
#endif