Skip to content

Commit

Permalink
Squashed 'src/phast/PhreeqcRM/' changes from fa8d13b0..b24b855c
Browse files Browse the repository at this point in the history
b24b855c Merge commit '0b34432c41c334f1bc7a227cbd8f0a169f2d5eb0'
0b34432c Squashed 'src/' changes from d50815e4..dc753eb6

git-subtree-dir: src/phast/PhreeqcRM
git-subtree-split: b24b855cb7f98261cb4dc755117f92b68fa6604e
  • Loading branch information
Darth Vader committed Jun 11, 2024
1 parent d48342a commit 0abda87
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/IPhreeqcPhast/IPhreeqc/phreeqcpp/Serializer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ Serializer::Deserialize(Phreeqc &phreeqc_ref, Dictionary &dictionary, std::vecto
#if !defined(R_SO)
std::cerr << "Unknown pack type in deserialize " << type << std::endl;
exit(4);
#else
std::ostringstream oss;
oss << "Unknown pack type in deserialize " << type << std::endl;
phreeqc_ref.error_msg(oss.str().c_str(), STOP);
#endif
break;
}
Expand Down
8 changes: 8 additions & 0 deletions src/IPhreeqcPhast/IPhreeqc/phreeqcpp/common/Utils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,17 @@ strcpy_safe(char* dest, size_t max, const char* src)
{
if (dest == nullptr || src == nullptr)
{
#if !defined(R_SO)
std::cerr << "nullptr in Utilities::strcpy_safe." << std::endl;
#endif
throw;
}
lsrc = strlen(src);
if (lsrc + 1 > max)
{
#if !defined(R_SO)
std::cerr << "Buffer overrun in Utilities::strcpy_safe." << std::endl;
#endif
throw;
}
memcpy(dest, src, (lsrc + 1) * sizeof(char));
Expand All @@ -224,14 +228,18 @@ strcat_safe(char* dest, size_t max, const char* src)
{
if (dest == nullptr || src == nullptr)
{
#if !defined(R_SO)
std::cerr << "nullptr in Utilities::strcat_safe." << std::endl;
#endif
throw;
}
lsrc = strlen(src);
ldest = strlen(dest);
if (ldest + lsrc + 1 > max)
{
#if !defined(R_SO)
std::cerr << "Buffer overrun in Utilities::strcat_safe." << std::endl;
#endif
throw;
}
memcpy(&dest[ldest], src, (lsrc + 1) * sizeof(char));
Expand Down

0 comments on commit 0abda87

Please # to comment.