aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-07-06 19:41:57 -0500
committerRob Landley <rob@landley.net>2015-07-06 19:41:57 -0500
commit3487bd353b4448bbdc9ece6d62fc4c4f4fd6ae4a (patch)
tree760cf34316c7672c2b7a6eeab5dff18669f7d29d
parentcc585db6949917ef8d9d72d88e2fdbb8d6c63df0 (diff)
downloadtoybox-3487bd353b4448bbdc9ece6d62fc4c4f4fd6ae4a.tar.gz
Avoid integer overflow with insane input data.
-rw-r--r--toys/posix/sort.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/sort.c b/toys/posix/sort.c
index 49e68c74..ed7c36ce 100644
--- a/toys/posix/sort.c
+++ b/toys/posix/sort.c
@@ -384,7 +384,7 @@ void sort_main(void)
// Output result
for (idx = 0; idx<TT.linecount; idx++) {
char *s = TT.lines[idx];
- int i = strlen(s);
+ unsigned i = strlen(s);
if (!(toys.optflags&FLAG_z)) s[i] = '\n';
xwrite(fd, s, i+1);