added patch to address underflow when -n is not a multiple of -l

from Nathan Jones: https://sourceforge.net/tracker/index.php?func=detail&aid=1943432&group_id=128336&atid=711373
This commit is contained in:
Jon Dugan 2008-05-10 02:26:48 +00:00
parent 7566010019
commit 0c9092408e
3 changed files with 21 additions and 2 deletions

View File

@ -28,3 +28,6 @@ Andrew Gallatin <gallatin@gmail.com>
Stephen Hemminger <shemminger@linux-foundation.org>
* Linux congestion control selection and theading improvements
Nathan Jones <nmjones@users.sourceforge.net>
* patch for underflow when value specified in -n is not a multiple of -l

View File

@ -1,3 +1,9 @@
2008-05-09 Nathan Jones <nmjones@users.sourceforge.net>
* prevent underflow when the amount of data to be transmitted (-n) is not a
multiple of the buffer size (-l) Patch:
https://sourceforge.net/tracker/index.php?func=detail&aid=1943432&group_id=128336&atid=711373
2008-04-08 Jon Dugan <jdugan@x1024.net>
* print report headers only once

View File

@ -170,7 +170,12 @@ void Client::RunTCP( void ) {
}
if ( !mMode_Time ) {
mSettings->mAmount -= currLen;
/* mAmount may be unsigned, so don't let it underflow! */
if( mSettings->mAmount >= currLen ) {
mSettings->mAmount -= currLen;
} else {
mSettings->mAmount = 0;
}
}
} while ( ! (sInterupted ||
@ -310,7 +315,12 @@ void Client::Run( void ) {
delay_loop( delay );
}
if ( !mMode_Time ) {
mSettings->mAmount -= currLen;
/* mAmount may be unsigned, so don't let it underflow! */
if( mSettings->mAmount >= currLen ) {
mSettings->mAmount -= currLen;
} else {
mSettings->mAmount = 0;
}
}
} while ( ! (sInterupted ||