summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Erik Hovland 2008-09-30 14:05:32 -0700
committerGravatar Dan Dennedy 2008-10-28 22:52:29 -0700
commit8ad324c971a14753c35f6135fa44dfe3c1a4bf82 (patch)
treee68d775ac20c8718898c3431f2fcb06becd5ce44 /src
parentProtect against resource leaks. (diff)
Compare unsigned values instead of subtracting them.
Unsigned values do not return signed values when subtracted and the right operand is larger then the left operand. Signed-off-by: Dan Dennedy <dan@dennedy.org>
Diffstat (limited to 'src')
-rw-r--r--src/fw.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/fw.c b/src/fw.c
index a229d1a..9c0c2e9 100644
--- a/src/fw.c
+++ b/src/fw.c
@@ -1310,9 +1310,10 @@ fw_bandwidth_modify (raw1394handle_t handle,
compare = ntohl (buffer);
switch (mode) {
case RAW1394_MODIFY_ALLOC:
- swap = compare - bandwidth;
- if (swap < 0)
+ if (compare < bandwidth)
return -1;
+
+ swap = compare - bandwidth;
break;
case RAW1394_MODIFY_FREE:
dth='13' height='13' alt='Gravatar' /> Arthur A. Gleckler 1-1/+1 2021-07-26typosGravatar John Cowan 1-1/+1 2021-07-26paired mutatorsGravatar John Cowan 1-43/+68 2021-07-26exceptionsGravatar John Cowan 1-1/+15 2021-07-26new exampleGravatar John Cowan 1-1/+4 2021-07-26updatesGravatar John Cowan 1-2/+4 2021-07-26dtd always first argumentGravatar John Cowan 1-9/+9 2021-07-26DTO to DTDGravatar John Cowan 1-55/+52 2021-07-26typoGravatar John Cowan 1-1/+1 2021-07-26switching to explicit dtosGravatar John Cowan 1-88/+102 2021-07-26errorsGravatar John Cowan 1-1/+4 2021-07-26more MN-W reviewGravatar John Cowan 1-5/+5 2021-07-26update preview linkGravatar John Cowan 1-1/+1 2021-07-26MN-W reviewGravatar John Cowan 1-6/+6 2021-07-26paired mutatorsGravatar John Cowan 1-43/+68 2021-07-25exceptionsGravatar John Cowan 1-1/+15 2021-07-25new exampleGravatar John Cowan 1-1/+4 2021-07-25updatesGravatar John Cowan 1-2/+4 2021-07-24dtd always first argumentGravatar John Cowan 1-9/+9 2021-07-23DTO to DTDGravatar John Cowan 1-55/+52 2021-07-22typoGravatar John Cowan 1-1/+1 2021-07-22switching to explicit dtosGravatar John Cowan 1-88/+102 2021-07-22errorsGravatar John Cowan 1-1/+4 2021-07-22more MN-W reviewGravatar John Cowan 1-5/+5 2021-07-20update preview linkGravatar John Cowan 1-1/+1 2021-07-20MN-W reviewGravatar John Cowan 1-6/+6 2021-07-18Fix typo.Gravatar Arthur A. Gleckler 2-4/+4 2021-07-18Add <p> around abstract.Gravatar Arthur A. Gleckler 1-2/+2 2021-07-18Publish first draft.draft-1Gravatar Arthur A. Gleckler 3-0/+114 2021-07-18Ignore trailing whitespace.Gravatar Arthur A. Gleckler 11-129/+129 2021-07-18Ignore "Dictionaries.log".Gravatar Arthur A. Gleckler 1-1/+2 2021-07-18Fix errors reported by W3C HTML Validator.Gravatar Arthur A. Gleckler 1-27/+27 2021-07-18Eliminate unnecessary redirect by using TLS/SSL.Gravatar Arthur A. Gleckler 1-1/+1