diff --git a/.gitignore b/.gitignore index e2ea07a..1988f77 100644 --- a/.gitignore +++ b/.gitignore @@ -11,14 +11,32 @@ config.h config.hin config.log config.status +config.guess +config.rpath +config.sub configure depcomp install-sh missing stamp-* +m4/* +po/Makefile +po/Makefile.in.in +po/Makevars.template +po/POTFILES +po/Rules-quot +po/boldquot.sed +po/dfshow.pot +po/en@boldquot.header +po/en@quot.header +po/insert-header.sin +po/quot.sed +po/remove-potcdate.sed +po/remove-potcdate.sin /bin/* /docs/build/* *.stackdump *~ valgrind* *.#* +ABOUT-NLS diff --git a/configure.ac b/configure.ac index e4934d0..51a537e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([dfshow],[0.9.4],[https://github.com/roberthawdon/dfshow/issues]) +AC_INIT([dfshow],[0.9.5],[https://github.com/roberthawdon/dfshow/issues]) AM_INIT_AUTOMAKE([subdir-objects]) AC_PROG_CC AC_CONFIG_HEADERS([config.h:config.hin]) diff --git a/docs/source/conf.py b/docs/source/conf.py index a04833f..316029b 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -26,7 +26,7 @@ # The short X.Y version version = '0.9' # The full version, including alpha/beta/rc tags -release = '0.9.4-beta' +release = '0.9.5-beta' # -- General configuration --------------------------------------------------- diff --git a/src/common.c b/src/common.c index 80ff55f..5f10d75 100644 --- a/src/common.c +++ b/src/common.c @@ -175,14 +175,15 @@ int createParentsInput(char *path) void createParentDirs(char *path){ pathDirs *targetPath; char *tempPath = malloc(sizeof(char) * 1); + char *tempPathWork; int e, i = 0; e = splitPath(&targetPath, path); tempPath[0]=0; for (i = 0; i < e; i++){ - tempPath = realloc(tempPath, sizeof(char) * (strlen(tempPath) + strlen(targetPath[i].directories) + 2)); - snprintf(tempPath, (strlen(tempPath) + strlen(targetPath[i].directories) + 2), "%s/%s", tempPath, targetPath[i].directories); + memcpy(tempPath, tempPathWork, (setDynamicChar(&tempPathWork, "%s/%s", tempPath, targetPath[i].directories) + 1)); + free(tempPathWork); if (!check_dir(tempPath)){ mk_dir(tempPath); } @@ -371,11 +372,12 @@ char *str_replace(char *orig, char *rep, char *with) { ins = tmp + len_rep; } - tmp_size = strlen(orig) + (len_with - len_rep) * count + 1; + tmp_size = (strlen(orig) + ((len_with - len_rep) * count) + 1); tmp = result = malloc(tmp_size); - if (!result) - return NULL; + if (!result){ + return NULL; + } // first time through the loop, all the variable are set correctly // from here on, @@ -391,7 +393,7 @@ char *str_replace(char *orig, char *rep, char *with) { tmp = tmp + len_with; orig += len_front + len_rep; // move to next "end of rep" } - memcpy(tmp, orig, tmp_size); + memcpy(tmp, orig, (strlen(orig) + 1)); return result; } @@ -564,7 +566,6 @@ void buildCommandArguments(const char *cmd, char **args, size_t items) // Getting the length of the input cmdLen = strlen(cmd); - // endwin(); // First sweep to get the number of args, and length itemCount = 0; argCharCount = 0; @@ -608,7 +609,7 @@ void buildCommandArguments(const char *cmd, char **args, size_t items) tempStr = calloc(itemLen[i] + 1, sizeof(char)); args[i] = calloc(itemLen[i] + 1, sizeof(char)); for (k = 0; k < itemLen[i]; k++){ - if ((cmdPos + cmdOffset + k) > cmdLen){ + if ((cmdPos + cmdOffset + k) > cmdLen - 1){ // Hacky workaround to avoid buffer overflow break; } @@ -628,6 +629,7 @@ void buildCommandArguments(const char *cmd, char **args, size_t items) cmdOffset++; } cmdOffset++; + goto checkBlank; } tempStr[k] = cmd[cmdPos + cmdOffset + k]; if (k == (itemLen[i] - 1)){ diff --git a/src/showfunctions.c b/src/showfunctions.c index 64154f9..8b98217 100644 --- a/src/showfunctions.c +++ b/src/showfunctions.c @@ -1568,8 +1568,7 @@ int SendToPager(char* object) fullCommand = calloc((strlen(page) + 1), sizeof(char)); snprintf(fullCommand, (strlen(page) + 1), "%s", page); escObject = str_replace(object, "'", "'\"'\"'"); - fullObject = calloc((strlen(escObject) + 3), sizeof(char)); - snprintf(fullObject, (strlen(escObject) + 3), "'%s'", escObject); + setDynamicChar(&fullObject, "'%s'", escObject); for (i = 1; i < noOfArgs; i++){ fullCommand = realloc(fullCommand, (strlen(fullCommand) + strlen(launchCommand[i]) + 2)); snprintf(fullCommand + strlen(fullCommand), (strlen(fullCommand) + strlen(launchCommand[i]) + 2), " %s", launchCommand[i]); @@ -1631,8 +1630,7 @@ int SendToEditor(char* object) fullCommand = calloc((strlen(editor) + 1), sizeof(char)); snprintf(fullCommand, (strlen(editor) + 1), "%s", editor); escObject = str_replace(object, "'", "'\"'\"'"); - fullObject = calloc((strlen(escObject) + 3), sizeof(char)); - snprintf(fullObject, (strlen(escObject) + 3), "'%s'", escObject); + setDynamicChar(&fullObject, "'%s'", escObject); for (i = 1; i < noOfArgs; i++){ fullCommand = realloc(fullCommand, (strlen(fullCommand) + strlen(launchCommand[i]) + 2)); snprintf(fullCommand + strlen(fullCommand), (strlen(fullCommand) + strlen(launchCommand[i]) + 2), " %s", launchCommand[i]);