Skip to content
Permalink
Browse files

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
  • Loading branch information...
Anushree Prakash B authored and vuvova committed Feb 28, 2019
1 parent 9d93f9d commit 9c6777c03c6bdeb329865fe56a9662d15058ff9f
Showing with 2 additions and 2 deletions.
  1. +2 −2 plugin/win_auth_client/common.cc
@@ -1,4 +1,4 @@
/* 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
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)
buf[0]= '\0';
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)buf, sizeof(buf), NULL );
(LPTSTR)buf, sizeof(Error_message_buf), NULL);

return buf;
}

0 comments on commit 9c6777c

Please sign in to comment.
You can’t perform that action at this time.