mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-14 09:48:01 +08:00
Fix #1453 - do not allow empty wakeup buffer
This commit is contained in:
parent
59c4dfa33b
commit
e565a7e73d
@ -902,11 +902,7 @@ static bool p_remove(const char *path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool p_mkdir(const char *path) {
|
static bool p_mkdir(const char *path) {
|
||||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
|
||||||
return mkdir(path) == 0;
|
|
||||||
#else
|
|
||||||
return mkdir(path, 0775) == 0;
|
return mkdir(path, 0775) == 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -3511,7 +3507,7 @@ static bool mg_socketpair(SOCKET sp[2], union usa usa[2]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mg_mgr_wakeup(struct mg_connection *c, const void *buf, size_t len) {
|
void mg_mgr_wakeup(struct mg_connection *c, const void *buf, size_t len) {
|
||||||
LOG(LL_INFO, ("skt: %p", c->pfn_data));
|
if (buf == NULL || len == 0) buf = (void *) "", len = 1;
|
||||||
send((SOCKET) (size_t) c->pfn_data, (const char *) buf, len, MSG_NONBLOCKING);
|
send((SOCKET) (size_t) c->pfn_data, (const char *) buf, len, MSG_NONBLOCKING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,6 +353,7 @@ struct timeval {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <direct.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
@ -408,6 +409,7 @@ typedef int socklen_t;
|
|||||||
|
|
||||||
#define realpath(a, b) _fullpath((b), (a), MG_PATH_MAX)
|
#define realpath(a, b) _fullpath((b), (a), MG_PATH_MAX)
|
||||||
#define sleep(x) Sleep(x)
|
#define sleep(x) Sleep(x)
|
||||||
|
#define mkdir(a, b) _mkdir(a)
|
||||||
|
|
||||||
#ifndef va_copy
|
#ifndef va_copy
|
||||||
#ifdef __va_copy
|
#ifdef __va_copy
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <direct.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
@ -70,6 +71,7 @@ typedef int socklen_t;
|
|||||||
|
|
||||||
#define realpath(a, b) _fullpath((b), (a), MG_PATH_MAX)
|
#define realpath(a, b) _fullpath((b), (a), MG_PATH_MAX)
|
||||||
#define sleep(x) Sleep(x)
|
#define sleep(x) Sleep(x)
|
||||||
|
#define mkdir(a, b) _mkdir(a)
|
||||||
|
|
||||||
#ifndef va_copy
|
#ifndef va_copy
|
||||||
#ifdef __va_copy
|
#ifdef __va_copy
|
||||||
|
@ -199,11 +199,7 @@ static bool p_remove(const char *path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool p_mkdir(const char *path) {
|
static bool p_mkdir(const char *path) {
|
||||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
|
||||||
return mkdir(path) == 0;
|
|
||||||
#else
|
|
||||||
return mkdir(path, 0775) == 0;
|
return mkdir(path, 0775) == 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -445,7 +445,7 @@ static bool mg_socketpair(SOCKET sp[2], union usa usa[2]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mg_mgr_wakeup(struct mg_connection *c, const void *buf, size_t len) {
|
void mg_mgr_wakeup(struct mg_connection *c, const void *buf, size_t len) {
|
||||||
LOG(LL_INFO, ("skt: %p", c->pfn_data));
|
if (buf == NULL || len == 0) buf = (void *) "", len = 1;
|
||||||
send((SOCKET) (size_t) c->pfn_data, (const char *) buf, len, MSG_NONBLOCKING);
|
send((SOCKET) (size_t) c->pfn_data, (const char *) buf, len, MSG_NONBLOCKING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user