diff options
author | Elliott Hughes <enh@google.com> | 2017-08-07 14:18:18 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2017-08-07 16:58:18 -0700 |
commit | 2a572d125a91a4aafd3ad8ce87259fc640fa0763 (patch) | |
tree | bd05e575a4a2629cc420c5e2bc54f176fee611ab /event_tagging.c | |
parent | 596447c7ff2881a67e7082c905112584c3e61a17 (diff) | |
download | libevent-2a572d125a91a4aafd3ad8ce87259fc640fa0763.tar.gz |
Upgrade to 2.1.8-stable (2017-01-22).
Bug: N/A
Test: builds
Change-Id: Idbbdc1db3d01984a4f4b60f8fdf455140b6b7ca6
Diffstat (limited to 'event_tagging.c')
-rw-r--r-- | event_tagging.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/event_tagging.c b/event_tagging.c index eea4bfc..6459dfa 100644 --- a/event_tagging.c +++ b/event_tagging.c @@ -26,25 +26,27 @@ */ #include "event2/event-config.h" +#include "evconfig-private.h" -#ifdef _EVENT_HAVE_SYS_TYPES_H +#ifdef EVENT__HAVE_SYS_TYPES_H #include <sys/types.h> #endif -#ifdef _EVENT_HAVE_SYS_PARAM_H +#ifdef EVENT__HAVE_SYS_PARAM_H #include <sys/param.h> #endif -#ifdef WIN32 +#ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include <winsock2.h> #include <windows.h> #undef WIN32_LEAN_AND_MEAN -#else -#include <sys/ioctl.h> #endif +#ifdef EVENT__HAVE_SYS_IOCTL_H +#include <sys/ioctl.h> +#endif #include <sys/queue.h> -#ifdef _EVENT_HAVE_SYS_TIME_H +#ifdef EVENT__HAVE_SYS_TIME_H #include <sys/time.h> #endif @@ -52,10 +54,10 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#ifndef WIN32 +#ifndef _WIN32 #include <syslog.h> #endif -#ifdef _EVENT_HAVE_UNISTD_H +#ifdef EVENT__HAVE_UNISTD_H #include <unistd.h> #endif #include <limits.h> @@ -211,7 +213,14 @@ decode_tag_internal(ev_uint32_t *ptag, struct evbuffer *evbuf, int dodrain) while (count++ < len) { ev_uint8_t lower = *data++; - number |= (lower & 0x7f) << shift; + if (shift >= 28) { + /* Make sure it fits into 32 bits */ + if (shift > 28) + return (-1); + if ((lower & 0x7f) > 15) + return (-1); + } + number |= (lower & (unsigned)0x7f) << shift; shift += 7; if (!(lower & 0x80)) { |