summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2011-03-29 15:55:04 (GMT)
committerJoão Abecasis <joao.abecasis@nokia.com>2011-04-04 11:22:52 (GMT)
commit9f806138930391b2dcb1d604ae39345a0bc7171a (patch)
tree69d57fd5042d41035a300c804bc25552af9fe410 /src/corelib/io
parente54f6f671011f39f30b8b585979353a58e46e6aa (diff)
downloadQt-9f806138930391b2dcb1d604ae39345a0bc7171a.zip
Qt-9f806138930391b2dcb1d604ae39345a0bc7171a.tar.gz
Qt-9f806138930391b2dcb1d604ae39345a0bc7171a.tar.bz2
Don't overrun XXXXXX placeholder when generating next filename
Checking of boundary condition needs to happen whenever there is a change. Checking anywhere else is useless. This fixes an issue where we would overrun the placeholder if there was a 'Z' next to the placeholder string. Reviewed-by: Robin Burchell
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qtemporaryfile.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index f6e3426..4ff0ee3 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -181,17 +181,15 @@ static int createFileFromTemplate(char *const path,
if (!*iter)
return -1;
if (*iter == 'Z') {
+ *iter++ = 'a';
if (iter == placeholderEnd)
return -1;
- *iter++ = 'a';
} else {
if (isdigit(*iter))
*iter = 'a';
else if (*iter == 'z') /* inc from z to A */
*iter = 'A';
else {
- if (iter == placeholderEnd)
- return -1;
++*iter;
}
break;