1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-07-05 02:53:16 +00:00

Enable gcc sanitizers

This commit is contained in:
jcorporation 2018-06-11 20:52:24 +01:00
parent d674ae5f13
commit 49694c78df
2 changed files with 12 additions and 10 deletions

View File

@ -22,7 +22,7 @@ include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} ${LIBMPDCLIENT_I
include(CheckCSourceCompiles) include(CheckCSourceCompiles)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -ggdb -pedantic -D_FORTIFY_SOURCE=2 -fstack-protector -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=unreachable -fsanitize=vla-bound -fsanitize=null -fsanitize=return -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=bounds-strict -fsanitize=alignment -fsanitize=object-size -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute -fsanitize=bool -fsanitize=enum -fsanitize=vptr -static-libasan")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -pedantic") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -pedantic")
if(WITH_IPV6) if(WITH_IPV6)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS NS_ENABLE_IPV6) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS NS_ENABLE_IPV6)

View File

@ -670,6 +670,7 @@ static int ns_parse_address(const char *str, union socket_address *sa,
*use_ssl = 0; *use_ssl = 0;
cert[0] = ca[0] = '\0'; cert[0] = ca[0] = '\0';
if (strlen(str)>=6) {
if (memcmp(str, "ssl://", 6) == 0) { if (memcmp(str, "ssl://", 6) == 0) {
str += 6; str += 6;
*use_ssl = 1; *use_ssl = 1;
@ -679,6 +680,7 @@ static int ns_parse_address(const char *str, union socket_address *sa,
} else if (memcmp(str, "tcp://", 6) == 0) { } else if (memcmp(str, "tcp://", 6) == 0) {
str += 6; str += 6;
} }
}
if (sscanf(str, "%u.%u.%u.%u:%u%n", &a, &b, &c, &d, &port, &len) == 5) { if (sscanf(str, "%u.%u.%u.%u:%u%n", &a, &b, &c, &d, &port, &len) == 5) {
// Bind to a specific IPv4 address, e.g. 192.168.1.5:8080 // Bind to a specific IPv4 address, e.g. 192.168.1.5:8080