aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2013-12-16 12:27:50 +0000
committerReuben Thomas <rrt@sc3d.org>2013-12-16 12:27:50 +0000
commitcff1bdca014abf286ae449524eab876c3313d39a (patch)
treeb1c11d1698eb5308a525a7bcd2e9a115eb09428c
parentbdc4e6f675930e28bfcb373225ef8cb4a9e47340 (diff)
downloadplptools-cff1bdca014abf286ae449524eab876c3313d39a.tar.gz
plptools-cff1bdca014abf286ae449524eab876c3313d39a.tar.bz2
plptools-cff1bdca014abf286ae449524eab876c3313d39a.zip
Fix a potential overrun in options parsing (thanks, Mayhem); fixes Debian bug #716591
-rw-r--r--plpfuse/main.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/plpfuse/main.cc b/plpfuse/main.cc
index 5ff2f78..07564a0 100644
--- a/plpfuse/main.cc
+++ b/plpfuse/main.cc
@@ -440,11 +440,13 @@ int main(int argc, char**argv) {
break;
case 'p':
parse_destination(optarg, &host, &sockNum);
- for (i = oldoptind; i < argc - (optind - oldoptind); i++)
- argv[i] = argv[i + (optind - oldoptind)];
argc -= optind - oldoptind;
+ for (i = oldoptind; i < argc; i++)
+ argv[i] = argv[i + (optind - oldoptind)];
break;
}
+ if (optind >= argc)
+ break;
}
skt = new ppsocket();