summaryrefslogtreecommitdiff
path: root/auth2-chall.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-01-22 23:26:38 +1100
committerDamien Miller <djm@mindrot.org>2002-01-22 23:26:38 +1100
commit0e3b87279c3f20630e616b4de1be7cae815682dd (patch)
tree171bd0872677cd0938cb223fe7c7fbf69fdd6e15 /auth2-chall.c
parent1a534ae97fc1d9e75384d8df44fef7f788c3629d (diff)
- markus@cvs.openbsd.org 2002/01/13 17:57:37
[auth2.c auth2-chall.c compat.c sshconnect2.c sshd.c] use buffer API and avoid static strings of fixed size; ok provos@/mouring@
Diffstat (limited to 'auth2-chall.c')
-rw-r--r--auth2-chall.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/auth2-chall.c b/auth2-chall.c
index a1f96392..9f1d9327 100644
--- a/auth2-chall.c
+++ b/auth2-chall.c
@@ -23,10 +23,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
-RCSID("$OpenBSD: auth2-chall.c,v 1.15 2002/01/11 23:02:51 markus Exp $");
+RCSID("$OpenBSD: auth2-chall.c,v 1.16 2002/01/13 17:57:37 markus Exp $");
#include "ssh2.h"
#include "auth.h"
+#include "buffer.h"
#include "packet.h"
#include "xmalloc.h"
#include "dispatch.h"
@@ -68,22 +69,25 @@ static KbdintAuthctxt *
kbdint_alloc(const char *devs)
{
KbdintAuthctxt *kbdintctxt;
+ Buffer b;
int i;
- char buf[1024];
kbdintctxt = xmalloc(sizeof(KbdintAuthctxt));
if (strcmp(devs, "") == 0) {
- buf[0] = '\0';
+ buffer_init(&b);
for (i = 0; devices[i]; i++) {
- if (i != 0)
- strlcat(buf, ",", sizeof(buf));
- strlcat(buf, devices[i]->name, sizeof(buf));
+ if (buffer_len(&b) > 0)
+ buffer_append(&b, ",", 1);
+ buffer_append(&b, devices[i]->name,
+ strlen(devices[i]->name));
}
- debug("kbdint_alloc: devices '%s'", buf);
- kbdintctxt->devices = xstrdup(buf);
+ buffer_append(&b, "\0", 1);
+ kbdintctxt->devices = xstrdup(buffer_ptr(&b));
+ buffer_free(&b);
} else {
kbdintctxt->devices = xstrdup(devs);
}
+ debug("kbdint_alloc: devices '%s'", kbdintctxt->devices);
kbdintctxt->ctxt = NULL;
kbdintctxt->device = NULL;