Skip to content
Snippets Groups Projects
Commit 41baf3ae authored by rswindell's avatar rswindell
Browse files

putnodedat() verifies valid file descriptor argument and always closes file.

parent f489e177
No related branches found
No related tags found
No related merge requests found
...@@ -688,8 +688,10 @@ int DLLCALL putnodedat(scfg_t* cfg, uint number, node_t* node, int file) ...@@ -688,8 +688,10 @@ int DLLCALL putnodedat(scfg_t* cfg, uint number, node_t* node, int file)
int wrerr; int wrerr;
int attempts; int attempts;
if(!number || number>cfg->sys_nodes) if(!number || number>cfg->sys_nodes || file<0) {
close(file);
return(-1); return(-1);
}
number--; /* make zero based */ number--; /* make zero based */
for(attempts=0;attempts<10;attempts++) { for(attempts=0;attempts<10;attempts++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment