[Forensics-changes] [yara] 129/135: Use strlcat, strlcpy, and snprintf instead of strcat, strcpy and sprint to avoid warning in OpenBSD

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


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

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

commit 8df08b832c653541a6685177c32c08a2fb0d84aa
Author: Victor Manuel Alvarez <vmalvarez at virustotal.com>
Date:   Mon Aug 25 10:20:44 2014 +0200

    Use strlcat, strlcpy, and snprintf instead of strcat, strcpy and sprint to avoid warning in OpenBSD
---
 libyara/lexer.c | 2 +-
 libyara/lexer.l | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libyara/lexer.c b/libyara/lexer.c
index c7c1e5a..44e7941 100644
--- a/libyara/lexer.c
+++ b/libyara/lexer.c
@@ -1705,7 +1705,7 @@ YY_RULE_SETUP
   s->length = len;
   s->flags = 0;
 
-  strcpy(s->c_string, yytext);
+  strlcpy(s->c_string, yytext, s->length);
   yylval->sized_string = s;
 
   return _HEX_STRING_;
diff --git a/libyara/lexer.l b/libyara/lexer.l
index e23be72..2a5fee8 100644
--- a/libyara/lexer.l
+++ b/libyara/lexer.l
@@ -531,7 +531,7 @@ $({letter}|{digit}|_)*  {
   s->length = len;
   s->flags = 0;
 
-  strcpy(s->c_string, yytext);
+  strlcpy(s->c_string, yytext, s->length);
   yylval->sized_string = s;
 
   return _HEX_STRING_;

-- 
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