mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
fix possible segfault due to non-functional range check with unsigned int
Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
parent
c3d991b23e
commit
f09e6e909b
1 changed files with 5 additions and 4 deletions
|
@ -310,16 +310,17 @@ int Node::write(struct Sample *smps[], unsigned cnt) {
|
|||
|
||||
#ifdef WITH_HOOKS
|
||||
// Run write hooks
|
||||
cnt = out.hooks.process(smps, cnt);
|
||||
if (cnt <= 0)
|
||||
return cnt;
|
||||
int hook_cnt = out.hooks.process(smps, cnt);
|
||||
if (hook_cnt <= 0)
|
||||
return hook_cnt;
|
||||
cnt = hook_cnt;
|
||||
#endif // WITH_HOOKS
|
||||
|
||||
vect = getFactory()->getVectorize();
|
||||
if (!vect)
|
||||
vect = cnt;
|
||||
|
||||
while (cnt - nsent > 0) {
|
||||
while (cnt > static_cast<unsigned>(nsent)) {
|
||||
tosend = MIN(cnt - nsent, vect);
|
||||
sent = _write(&smps[nsent], tosend);
|
||||
if (sent < 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue