mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Fix buffer size in pickersCLI.cpp (#8282)
Was a bit too diabolical. `fgets` reads size-1 bytes and writes `\0` after it, so we should be fine with `sizeof(buffer)` here, which also more resilient to future errors than any duplicated value.
This commit is contained in:
committed by
greg landrum
parent
5bbb874eb2
commit
70b7e13bed
@@ -34,7 +34,7 @@ static unsigned int LoadDatabase(FILE *fp) {
|
||||
char buffer[32768];
|
||||
unsigned int result = 0;
|
||||
|
||||
while (fgets(buffer, 327666, fp)) {
|
||||
while (fgets(buffer, sizeof(buffer), fp)) {
|
||||
if (buffer[0] == '#' || buffer[0] == ' ' || buffer[0] == '\t') continue;
|
||||
char *ptr = buffer;
|
||||
while (*ptr && *ptr != ' ' && *ptr != '\t') ptr++;
|
||||
|
||||
Reference in New Issue
Block a user