Commit 9c6777c0 authored by Anushree Prakash B's avatar Anushree Prakash B Committed by Sergei Golubchik

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
parent 9d93f9da
/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by 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) ...@@ -504,7 +504,7 @@ const char* get_last_error_message(Error_message_buf buf)
buf[0]= '\0'; buf[0]= '\0';
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)buf, sizeof(buf), NULL ); (LPTSTR)buf, sizeof(Error_message_buf), NULL);
return buf; return buf;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment