the easier way to put a buffer on the stack is to put it on the stack,
authortedu <tedu@openbsd.org>
Wed, 17 Dec 2014 22:23:33 +0000 (22:23 +0000)
committertedu <tedu@openbsd.org>
Wed, 17 Dec 2014 22:23:33 +0000 (22:23 +0000)
not with alloca(). found by dickman; ok kettenis

usr.sbin/tftpd/tftpd.c

index dd526f4..a579b7b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: tftpd.c,v 1.24 2014/11/25 23:52:09 dlg Exp $  */
+/*     $OpenBSD: tftpd.c,v 1.25 2014/12/17 22:23:33 tedu Exp $ */
 
 /*
  * Copyright (c) 2012 David Gwynne <dlg@uq.edu.au>
@@ -645,7 +645,7 @@ tftpd_recv(int fd, short events, void *arg)
 
        client = client_alloc();
        if (client == NULL) {
-               char *buf = alloca(SEGSIZE_MAX + 4);
+               char buf[SEGSIZE_MAX + 4];
                /* no memory! flush this request... */
                recv(fd, buf, SEGSIZE_MAX + 4, 0);
                /* dont care if it fails */