* Paul Littlefield
* Robert van der Meulen
* Teemu Kiviniemi
+* Tonnerre Lombard
* Wessel Dankers
* Wouter van Heyst
extern bool tunnelserver;
-/* Maximum size of strings in a request */
+/* Maximum size of strings in a request.
+ * scanf terminates %2048s with a NUL character,
+ * but the NUL character can be written after the 2048th non-NUL character.
+ */
-#define MAX_STRING_SIZE 2048
+#define MAX_STRING_SIZE 2049
#define MAX_STRING "%2048s"
#include "edge.h"
bool send_metakey(connection_t *c)
{
- char buffer[MAX_STRING_SIZE];
+ char *buffer;
int len;
bool x;
/* Allocate buffers for the meta key */
+ buffer = alloca(2 * len + 1);
+
if(!c->outkey)
c->outkey = xmalloc(len);
bool send_challenge(connection_t *c)
{
- char buffer[MAX_STRING_SIZE];
+ char *buffer;
int len;
cp();
/* Allocate buffers for the challenge */
+ buffer = alloca(2 * len + 1);
+
if(!c->hischallenge)
c->hischallenge = xmalloc(len);
bool send_ans_key(connection_t *c, const node_t *from, const node_t *to)
{
- char key[MAX_STRING_SIZE];
+ char *key;
cp();
+ key = alloca(2 * from->keylength + 1);
bin2hex(from->key, key, from->keylength);
key[from->keylength * 2] = '\0';