From 9f806138930391b2dcb1d604ae39345a0bc7171a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 29 Mar 2011 17:55:04 +0200 Subject: 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 --- src/corelib/io/qtemporaryfile.cpp | 4 +--- 1 file changed, 1 insertion(+), 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; -- cgit v0.12