From 86b0febac0a5eeeb68f0672177006ceb942af8ef Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 2 Mar 2015 18:37:50 +0100 Subject: [PATCH 1/6] fix BSD string function detection --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index aaf07e2a1..7cfd54e3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,9 @@ CHECK_SYMBOL_EXISTS (sleep "unistd.h" HAVE_SLEEP) CHECK_SYMBOL_EXISTS (usleep "unistd.h" HAVE_USLEEP) CHECK_SYMBOL_EXISTS (access "unistd.h" HAVE_ACCESS) ENDIF(HAVE_UNISTD_H) +CHECK_SYMBOL_EXISTS (strlcpy "string.h" HAVE_STRLCPY) +CHECK_SYMBOL_EXISTS (strlcat "string.h" HAVE_STRLCAT) +CHECK_SYMBOL_EXISTS (slprintf "string.h" HAVE_SLPRINTF) CHECK_SYMBOL_EXISTS (strcasecmp "string.h" HAVE_STRCASECMP) CHECK_SYMBOL_EXISTS (strncasecmp "string.h" HAVE_STRNCASECMP) CHECK_SYMBOL_EXISTS (_strlwr "string.h" HAVE__STRLWR) From 48ea310364d69cf8b9b53858bb4047ec5fcd5ae4 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 2 Mar 2015 22:56:35 +0100 Subject: [PATCH 2/6] don't call nproc if the system doesn't have it --- s/build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/s/build b/s/build index 40ab81283..068a669a1 100755 --- a/s/build +++ b/s/build @@ -1,7 +1,7 @@ #!/bin/sh -ROOT=$(pwd) +ROOT=`pwd` while [ ! -d $ROOT/.git ]; do - ROOT=$(dirname $ROOT) + ROOT=`dirname $ROOT` done [ -z $BUILD ] && BUILD=Debug @@ -11,7 +11,7 @@ MACHINE=`uname -m` [ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc" BIN_DIR="build-$MACHINE-$CC-$BUILD" -[ -z "$JOBS" ] && JOBS=$(nproc) +[ -z "$JOBS" ] && [ "" != "which nproc" ] && JOBS=`nproc` DISTCC=`which distcc` if [ ! -z "$DISTCC" ] ; then JOBS=`distcc -j` From 6a5458c119b105c1e94b6d6497997353664936af Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 2 Mar 2015 18:37:50 +0100 Subject: [PATCH 3/6] fix BSD string function detection --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index aaf07e2a1..7cfd54e3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,9 @@ CHECK_SYMBOL_EXISTS (sleep "unistd.h" HAVE_SLEEP) CHECK_SYMBOL_EXISTS (usleep "unistd.h" HAVE_USLEEP) CHECK_SYMBOL_EXISTS (access "unistd.h" HAVE_ACCESS) ENDIF(HAVE_UNISTD_H) +CHECK_SYMBOL_EXISTS (strlcpy "string.h" HAVE_STRLCPY) +CHECK_SYMBOL_EXISTS (strlcat "string.h" HAVE_STRLCAT) +CHECK_SYMBOL_EXISTS (slprintf "string.h" HAVE_SLPRINTF) CHECK_SYMBOL_EXISTS (strcasecmp "string.h" HAVE_STRCASECMP) CHECK_SYMBOL_EXISTS (strncasecmp "string.h" HAVE_STRNCASECMP) CHECK_SYMBOL_EXISTS (_strlwr "string.h" HAVE__STRLWR) From 7ae7fa24d86a0420555c8d42f026717772161d09 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 2 Mar 2015 22:56:35 +0100 Subject: [PATCH 4/6] don't call nproc if the system doesn't have it --- s/build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/s/build b/s/build index 40ab81283..068a669a1 100755 --- a/s/build +++ b/s/build @@ -1,7 +1,7 @@ #!/bin/sh -ROOT=$(pwd) +ROOT=`pwd` while [ ! -d $ROOT/.git ]; do - ROOT=$(dirname $ROOT) + ROOT=`dirname $ROOT` done [ -z $BUILD ] && BUILD=Debug @@ -11,7 +11,7 @@ MACHINE=`uname -m` [ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc" BIN_DIR="build-$MACHINE-$CC-$BUILD" -[ -z "$JOBS" ] && JOBS=$(nproc) +[ -z "$JOBS" ] && [ "" != "which nproc" ] && JOBS=`nproc` DISTCC=`which distcc` if [ ! -z "$DISTCC" ] ; then JOBS=`distcc -j` From 658c7c9f96ac1d08329e50c37bd4900c5cdd52a7 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 3 Mar 2015 07:04:04 +0100 Subject: [PATCH 5/6] forgot to declare cmakedefine variables for Mac build --- autoconf.h.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autoconf.h.in b/autoconf.h.in index 5144d9ecc..1c151b6f9 100644 --- a/autoconf.h.in +++ b/autoconf.h.in @@ -26,6 +26,9 @@ #cmakedefine HAVE_MEMICMP 1 #cmakedefine HAVE__STRLWR 1 #cmakedefine HAVE_STRLWR 1 +#cmakedefine HAVE_STRLCPY 1 +#cmakedefine HAVE_STRLCAT 1 +#cmakedefine HAVE_SLPRINTF 1 #cmakedefine HAVE_SYS_STAT_MKDIR 1 #cmakedefine HAVE_DIRECT_MKDIR 1 #cmakedefine HAVE_DIRECT__MKDIR 1 From 4ce2429276d31b78c3a9de801caa31870d971401 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 4 Mar 2015 22:19:11 +0100 Subject: [PATCH 6/6] fix keyword-buffer overflow --- src/kernel/config.h | 1 - src/keyword.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/kernel/config.h b/src/kernel/config.h index a10186e6d..caffedb9e 100644 --- a/src/kernel/config.h +++ b/src/kernel/config.h @@ -81,7 +81,6 @@ extern "C" { #define ORDERSIZE (DISPLAYSIZE*2) /* max. length of an order */ #define NAMESIZE 128 /* max. Länge eines Namens, incl trailing 0 */ #define IDSIZE 16 /* max. Länge einer no (als String), incl trailing 0 */ -#define KEYWORDSIZE 16 /* max. Länge eines Keyword, incl trailing 0 */ #define OBJECTIDSIZE (NAMESIZE+5+IDSIZE) /* max. Länge der Strings, die * von struct unitname, etc. zurückgegeben werden. ohne die 0 */ diff --git a/src/keyword.c b/src/keyword.c index fde981bb9..1ffdc4c3c 100644 --- a/src/keyword.c +++ b/src/keyword.c @@ -12,7 +12,7 @@ const char * keyword(keyword_t kwd) { - static char result[KEYWORDSIZE]; // FIXME: static return value + static char result[32]; // FIXME: static return value if (!result[0]) { strcpy(result, "keyword::"); }