From aff350f593975cc71bb2eb7dbb732001c2ab73c6 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 6 Mar 2018 14:25:18 +0100 Subject: [PATCH] LIB_ID: change strcpy() to strncpy() for safety --- common/lib_id.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/lib_id.cpp b/common/lib_id.cpp index 95f5de015b..b5157aaf6e 100644 --- a/common/lib_id.cpp +++ b/common/lib_id.cpp @@ -93,11 +93,11 @@ static inline int okLogical( const UTF8& aField ) static int okRevision( const UTF8& aField ) { - char rev[32]; // C string for speed + char rev[32]; // C string for speed if( aField.size() >= 4 ) { - strcpy( rev, "x/" ); + strncpy( rev, "x/", sizeof( rev ) ); strncat( rev, aField.c_str(), sizeof(rev)-strlen(rev)-1 ); if( EndsWithRev( rev, rev + strlen(rev), '/' ) == rev+2 )