biod.pnpi.spb.ru
/
alexxy
/
gromacs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1d8625e
)
Fix memory corruption with strings in grompp
author
Berk Hess
<hess@kth.se>
Thu, 10 Sep 2020 09:00:52 +0000
(11:00 +0200)
committer
Berk Hess
<hess@kth.se>
Thu, 10 Sep 2020 09:01:32 +0000
(11:01 +0200)
Using a string of more than 31 characters as a default value for
a string entry in the mdp file would lead to memory corruption.
src/gromacs/fileio/readinp.cpp
patch
|
blob
|
history
diff --git
a/src/gromacs/fileio/readinp.cpp
b/src/gromacs/fileio/readinp.cpp
index 907e49050a7c5fd639115e831a5e4c1bbe8c997f..10797d31e79af884ba1e09ded56f919f888c25fb 100644
(file)
--- a/
src/gromacs/fileio/readinp.cpp
+++ b/
src/gromacs/fileio/readinp.cpp
@@
-452,7
+452,6
@@
double get_ereal(std::vector<t_inpfile>* inp, const std::string& name, double de
const char* get_estr(std::vector<t_inpfile>* inp, const char* name, const char* def)
{
std::vector<t_inpfile>& inpRef = *inp;
- char buf[32];
int ii = get_einp(inp, name);
@@
-460,8
+459,7
@@
const char* get_estr(std::vector<t_inpfile>* inp, const char* name, const char*
{
if (def)
{
- sprintf(buf, "%s", def);
- inpRef.back().value_.assign(buf);
+ inpRef.back().value_.assign(def);
}
else
{