[Forensics-changes] [yara] 04/407: Fix #164

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:27:56 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.3.0
in repository yara.

commit 41493c9685a1b0d29d0bf5571f2c1eedaae12332
Author: Victor Manuel Alvarez <vmalvarez at virustotal.com>
Date:   Tue Aug 26 23:09:29 2014 +0200

    Fix #164
---
 configure.ac                 |  3 ++-
 libyara/include/yara/utils.h | 12 +++++++-----
 libyara/utils.c              |  8 +++++++-
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 313c247..1e1509f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,8 +42,9 @@ AC_ARG_ENABLE([magic],
     AC_DEFINE([MAGIC], [1], [enable magic module])
   fi])
 
-AM_CONDITIONAL([CUCKOO], [test x$cuckoo = xtrue])
+AC_CHECK_FUNCS_ONCE(strlcpy strlcat)
 
+AM_CONDITIONAL([CUCKOO], [test x$cuckoo = xtrue])
 AM_CONDITIONAL([MAGIC], [test x$magic = xtrue])
 
 AC_CHECK_LIB(pthread, pthread_create)
diff --git a/libyara/include/yara/utils.h b/libyara/include/yara/utils.h
index c793e68..c5fc7aa 100644
--- a/libyara/include/yara/utils.h
+++ b/libyara/include/yara/utils.h
@@ -20,6 +20,8 @@ limitations under the License.
 #include <assert.h>
 #include <stdlib.h>
 
+#include "config.h"
+
 #ifndef TRUE
 #define TRUE 1
 #endif
@@ -62,16 +64,16 @@ limitations under the License.
     }
 #endif
 
-
-
 size_t xtoi(const char* hexstr);
 
-#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
-
+#if !HAVE_STRLCPY
 size_t strlcpy(char *dst, const char *src, size_t size);
+#endif
 
+#if !HAVE_STRLCAT
 size_t strlcat(char *dst, const char *src, size_t size);
-
 #endif
 
 #endif
+
+
diff --git a/libyara/utils.c b/libyara/utils.c
index 5334dfb..730e34a 100644
--- a/libyara/utils.c
+++ b/libyara/utils.c
@@ -17,6 +17,8 @@ limitations under the License.
 #include <stdio.h>
 #include <string.h>
 
+#include "config.h"
+
 size_t xtoi(const char* hexstr)
 {
   size_t r = 0;
@@ -64,7 +66,6 @@ size_t xtoi(const char* hexstr)
 }
 
 
-#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
 
 /*
 
@@ -73,6 +74,7 @@ the following implementations were taken from OpenBSD.
 
 */
 
+#if !HAVE_STRLCPY
 
 size_t strlcpy(char *dst, const char *src, size_t size)
 {
@@ -105,6 +107,10 @@ size_t strlcpy(char *dst, const char *src, size_t size)
   return(s - src - 1);  /* count does not include NUL */
 }
 
+#endif
+
+
+#if !HAVE_STRLCAT
 
 size_t strlcat(char *dst, const char *src, size_t size)
 {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list