1
0
mirror of https://git.sr.ht/~sircmpwn/gmnisrv synced 2024-12-04 14:46:42 -05:00

Bump client buffer size to BUFSIZ

This commit is contained in:
Drew DeVault 2020-09-26 14:45:17 -04:00
parent 9bed26b8d9
commit 48f75abcfd
2 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
#ifndef GMNISRV_SERVER #ifndef GMNISRV_SERVER
#define GMNISRV_SERVER #define GMNISRV_SERVER
#include <assert.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <poll.h> #include <poll.h>
#include <time.h> #include <time.h>
@ -25,7 +26,8 @@ struct gmnisrv_client {
SSL *ssl; SSL *ssl;
BIO *bio, *sbio; BIO *bio, *sbio;
char buf[GEMINI_MAX_URL + 3]; char buf[BUFSIZ];
static_assert(BUFSIZ >= GEMINI_MAX_URL + 3);
size_t bufix, bufln; size_t bufix, bufln;
enum response_state state; enum response_state state;

View File

@ -362,7 +362,6 @@ client_readable(struct gmnisrv_server *server, struct gmnisrv_client *client)
return; return;
} }
// XXX: Can buf be statically allocated?
int r = BIO_gets(client->bio, client->buf, sizeof(client->buf)); int r = BIO_gets(client->bio, client->buf, sizeof(client->buf));
if (r <= 0) { if (r <= 0) {
r = SSL_get_error(client->ssl, r); r = SSL_get_error(client->ssl, r);