Skip to content

Commit 7f6ebf0

Browse files
author
Anushree Prakash B
committed
Bug#27259654 - ISSUES FOUND BY PVS-STUDIO STATIC ANALYZER
DESCRIPTION =========== PVS-Studio static code analyzer found several suspicious fragments of code across various files. i) sizeof() is using the pointer ii) memcpy() doesn't copy the whole string. iii) enumeration constant 'wkb_multilinestring' is used as a variable of a Boolean-type. iv) 'throw' keyword is missing from std::runtime_error() FIX === i) Use sizeof({actual object/data type}) ii) Use strncpy() and set last char as '\0' iii) N/A (Issue has already been fixed) iv) Add 'throw' before the exception. RB: 21502
1 parent beb37ed commit 7f6ebf0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libmysql/authentication_win/common.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -504,7 +504,7 @@ const char* get_last_error_message(Error_message_buf buf)
504504
buf[0]= '\0';
505505
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
506506
NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
507-
(LPTSTR)buf, sizeof(buf), NULL );
507+
(LPTSTR)buf, sizeof(Error_message_buf), NULL);
508508

509509
return buf;
510510
}

0 commit comments

Comments
 (0)