Skip to content

Commit 5b2077a

Browse files
author
Vasiliy Evseenko
committed
Fix include path
Fix possible buffer overflow
1 parent cb4a3f3 commit 5b2077a

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
# USE_SHARED_CACHE : enable/disable a shared session cache (disabled by default)
44

55
DESTDIR =
6-
PREFIX = /usr/local
6+
PREFIX = /usr
77
BINDIR = $(PREFIX)/bin
88
MANDIR = $(PREFIX)/share/man
99

10-
CFLAGS += -O2 -g -std=c99 -fno-strict-aliasing -Wall -W -D_GNU_SOURCE -I/usr/local/include
11-
LDFLAGS += -lssl -lcrypto -lev -L/usr/local/lib
10+
CFLAGS += -O2 -g -std=c99 -fno-strict-aliasing -Wall -W -D_GNU_SOURCE
11+
LDFLAGS += -lssl -lcrypto -lev
1212
OBJS = stud.o ringbuffer.o configuration.o
1313

1414
all: realall

stud.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#include <openssl/err.h>
6161
#include <openssl/engine.h>
6262
#include <openssl/asn1.h>
63-
#include <ev.h>
63+
#include <libev/ev.h>
6464

6565
#include "ringbuffer.h"
6666
#include "shctx.h"
@@ -1381,11 +1381,10 @@ static void client_handshake(struct ev_loop *loop, ev_io *w, int revents) {
13811381
}
13821382
else {
13831383
// Try and get more detail on the error from the SSL
1384-
// error queue. ERR_error_string requires a char buffer
1385-
// of 120 bytes.
1384+
// error queue.
13861385
unsigned long err_detail = ERR_get_error();
1387-
char err_msg[120];
1388-
ERR_error_string(err_detail, err_msg);
1386+
char err_msg[120]; //recommended size for ERR_error_string
1387+
ERR_error_string_n(err_detail, err_msg, sizeof(err_msg));
13891388

13901389
LOG("{%s} Unexpected SSL error (in handshake): %d, %s\n", w->fd == ps->fd_up ? "client" : "backend", err, err_msg);
13911390
shutdown_proxy(ps, SHUTDOWN_SSL);

0 commit comments

Comments
 (0)