diff options
author | Pino Toscano <pino@kde.org> | 2013-09-16 19:46:55 +0200 |
---|---|---|
committer | Pino Toscano <pino@kde.org> | 2013-09-16 19:46:55 +0200 |
commit | b8682d868ddf7f741e93b791588af0932893f95c (patch) | |
tree | ead5cb0d0caeec0bd3f4fe45526e9dcfefdf9abd | |
parent | 563da2d375c003478d398897796ecbf45ce03482 (diff) |
pdfseparate: improve the path building
Make use of snprintf to limit the output to the pathName buffer;
while I'm there, expand its size to 4096 (might help longer paths),
although a better fix would be dynamically allocate its length
(and/or using GooString, maybe).
-rw-r--r-- | utils/pdfseparate.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/utils/pdfseparate.cc b/utils/pdfseparate.cc index 35ae0209..e41e547e 100644 --- a/utils/pdfseparate.cc +++ b/utils/pdfseparate.cc @@ -44,7 +44,7 @@ static const ArgDesc argDesc[] = { }; bool extractPages (const char *srcFileName, const char *destFileName) { - char pathName[1024]; + char pathName[4096]; GooString *gfileName = new GooString (srcFileName); PDFDoc *doc = new PDFDoc (gfileName, NULL, NULL, NULL); @@ -66,7 +66,7 @@ bool extractPages (const char *srcFileName, const char *destFileName) { return false; } for (int pageNo = firstPage; pageNo <= lastPage; pageNo++) { - sprintf (pathName, destFileName, pageNo); + snprintf (pathName, sizeof (pathName) - 1, destFileName, pageNo); GooString *gpageName = new GooString (pathName); int errCode = doc->savePageAs(gpageName, pageNo); if ( errCode != errNone) { |