[Forensics-changes] [yara] 31/368: Use strncpy as proposed by Hilko Bengen in PR #314
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:30:07 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.5.0
in repository yara.
commit 14dbf62b132c1d7294fa3b4a535d5fec3f6246b9
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Thu Jul 30 19:39:05 2015 +0200
Use strncpy as proposed by Hilko Bengen in PR #314
It does the same but is more compact and elegant.
---
libyara/modules/pe.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/libyara/modules/pe.c b/libyara/modules/pe.c
index 9577e7f..4dcc13c 100644
--- a/libyara/modules/pe.c
+++ b/libyara/modules/pe.c
@@ -1304,12 +1304,8 @@ void pe_parse_header(
if (!struct_fits_in_pe(pe, section, IMAGE_SECTION_HEADER))
break;
- int n = 0;
-
- for (; n < IMAGE_SIZEOF_SHORT_NAME && section->Name[n]; n++)
- section_name[n] = section->Name[n];
-
- section_name[n] = '\0';
+ strncpy(section_name, (char*) section->Name, IMAGE_SIZEOF_SHORT_NAME);
+ section_name[IMAGE_SIZEOF_SHORT_NAME] = '\0';
set_string(
section_name,
--
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