dbaccess/source/core/api/RowSetCache.cxx | 2 extensions/source/nsplugin/source/npshell.cxx | 6 hwpfilter/source/hbox.cxx | 190 ++++---- rsc/source/rscpp/cpp1.c | 602 +++++++++++++------------- sal/osl/unx/process.cxx | 25 - 5 files changed, 427 insertions(+), 398 deletions(-)
New commits: commit d1e6ecb3538e06cd4691e4296597748b9394410d Author: Norbert Thiebaud <[email protected]> Date: Sat Jul 5 22:26:39 2014 +0200 coverity#983489 String Overflow Change-Id: I146844d10dc6ee147031a8ffa6fabe9e271b2bd0 diff --git a/extensions/source/nsplugin/source/npshell.cxx b/extensions/source/nsplugin/source/npshell.cxx index 242c39d..cae8fbe 100644 --- a/extensions/source/nsplugin/source/npshell.cxx +++ b/extensions/source/nsplugin/source/npshell.cxx @@ -708,8 +708,10 @@ NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) char* pfilename = NULL; if (NULL != (pfilename = strrchr(url, '/'))) { - strcpy(filename, pfilename+1); - } else { + strncat(filename, pfilename+1, 1024); + } + else + { return; } commit 54bf6b1205b0f0e02554ceb4cff3b50f67cc8eee Author: Norbert Thiebaud <[email protected]> Date: Sat Jul 5 22:22:38 2014 +0200 coverity#983491 String Overflow Change-Id: Ic634f183a531c1ecda61b31a0883934bd7842dcc diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx index 006dc4c..ca1b2a9 100644 --- a/hwpfilter/source/hbox.cxx +++ b/hwpfilter/source/hbox.cxx @@ -170,112 +170,112 @@ hchar_string DateCode::GetString() switch (*fmt) { - case '0': - add_zero = true; + case '0': + add_zero = true; + break; + case '1': + num = date[YEAR]; + form = "%04d"; + break; + case '!': + num = date[YEAR] % 100; + break; + case '2': + num = date[MONTH]; + break; + case '@': + memcpy(cbuf, eng_mon + (date[MONTH] - 1) * 3, 3); + cbuf[3] = '.'; + cbuf[4] = 0; break; - case '1': - num = date[YEAR]; - form = "%04d"; - break; - case '!': - num = date[YEAR] % 100; - break; - case '2': - num = date[MONTH]; - break; - case '@': - memcpy(cbuf, eng_mon + (date[MONTH] - 1) * 3, 3); - cbuf[3] = '.'; - cbuf[4] = 0; - break; - case '*': - strcpy(cbuf, en_mon[date[MONTH] - 1]); - break; - case '3': /* 'D' is day of korean */ - num = date[DAY]; - break; - case '#': - num = date[DAY]; - switch (date[DAY] % 10) - { - case 1: - form = "%dst"; - break; - case 2: - form = "%dnd"; - break; - case 3: - form = "%drd"; - break; - default: - form = "%dth"; - break; - } - break; - case '4': - num = date[HOUR] - ((date[HOUR] > 12) ? 12 : 0); - break; - case '$': - num = date[HOUR]; - break; - case '5': - case '%': - num = date[MIN]; - break; - case '6': - ret.push_back(kor_week[date[WEEK]]); - break; - case '^': - memcpy(cbuf, eng_week + date[WEEK] * 3, 3); - cbuf[3] = '.'; - cbuf[4] = 0; - break; - case '_': - strcpy(cbuf, en_week[date[WEEK]]); + case '*': + strncat(cbuf, en_mon[date[MONTH] - 1], 256); + break; + case '3': /* 'D' is day of korean */ + num = date[DAY]; + break; + case '#': + num = date[DAY]; + switch (date[DAY] % 10) + { + case 1: + form = "%dst"; break; - case '7': - ret.push_back(0xB5A1); - ret.push_back((is_pm) ? 0xD281 : 0xB8E5); + case 2: + form = "%dnd"; break; - case '&': - strcpy(cbuf, (is_pm) ? "p.m." : "a.m."); + case 3: + form = "%drd"; break; - case '+': - strcpy(cbuf, (is_pm) ? "P.M." : "A.M."); + default: + form = "%dth"; break; - case '8': // 2.5 feature - case '9': + } + break; + case '4': + num = date[HOUR] - ((date[HOUR] > 12) ? 12 : 0); + break; + case '$': + num = date[HOUR]; + break; + case '5': + case '%': + num = date[MIN]; + break; + case '6': + ret.push_back(kor_week[date[WEEK]]); + break; + case '^': + memcpy(cbuf, eng_week + date[WEEK] * 3, 3); + cbuf[3] = '.'; + cbuf[4] = 0; + break; + case '_': + strncat(cbuf, en_week[date[WEEK]], 256); + break; + case '7': + ret.push_back(0xB5A1); + ret.push_back((is_pm) ? 0xD281 : 0xB8E5); + break; + case '&': + strncat(cbuf, (is_pm) ? "p.m." : "a.m.", 256); + break; + case '+': + strncat(cbuf, (is_pm) ? "P.M." : "A.M.", 256); + break; + case '8': // 2.5 feature + case '9': #if 0 // LATER - mkcurfilename(cbuf, *fmt); - for (i = 0; cbuf[i] != 0 && slen > 1; i++) - { //for hangle filename - if (cbuf[i] & 0x80 && cbuf[i + 1] != 0) - { - *d++ = (cbuf[i] << 8) | cbuf[i + 1]; - i++; - } - else - *d++ = cbuf[i]; - slen--; + mkcurfilename(cbuf, *fmt); + for (i = 0; cbuf[i] != 0 && slen > 1; i++) + { //for hangle filename + if (cbuf[i] & 0x80 && cbuf[i + 1] != 0) + { + *d++ = (cbuf[i] << 8) | cbuf[i + 1]; + i++; } + else + *d++ = cbuf[i]; + slen--; + } #endif - cbuf[0] = 0; + cbuf[0] = 0; + break; + case '~': // 3.0b feature + if (fmt[1] == 0) break; - case '~': // 3.0b feature - if (fmt[1] == 0) - break; - fmt++; - if (*fmt == '6') - { - ret.push_back(china_week[date[WEEK]]); - break; - } + fmt++; + if (*fmt == '6') + { + ret.push_back(china_week[date[WEEK]]); break; - default: - if (*fmt == '\\' && *++fmt == 0) - goto done; - ret.push_back(*fmt); + } + break; + default: + if (*fmt == '\\' && *++fmt == 0) + goto done; + ret.push_back(*fmt); } if (num != -1) sprintf(cbuf, form, num); commit ecdf4e2b90d664655f3cee1364b38218492e9ea6 Author: Norbert Thiebaud <[email protected]> Date: Sat Jul 5 22:05:32 2014 +0200 coverity#983492 String Overflow Change-Id: I60b38e494e063044d84acd660b18c91d297d3c04 diff --git a/rsc/source/rscpp/cpp1.c b/rsc/source/rscpp/cpp1.c index ff505ca..d5445b8 100644 --- a/rsc/source/rscpp/cpp1.c +++ b/rsc/source/rscpp/cpp1.c @@ -328,7 +328,7 @@ int MAIN(int argc, char** argv) cerror("Can't open input file \"%s\"", useargv[1]); exit(IO_ERROR); } - strcpy(work, useargv[1]); /* Remember input filename */ + strncpy(work, useargv[1], NWORK); /* Remember input filename */ break; } /* Else, just get stdin */ case 0: /* No args? */ commit 393f77fa675da448d6b0a02dc3bab9c0b4998f69 Author: Norbert Thiebaud <[email protected]> Date: Sat Jul 5 22:04:04 2014 +0200 cosmetic clean-up, prep for patches Change-Id: I930afa189665ddc3ce8d160fa954e11a7a2aed8c diff --git a/rsc/source/rscpp/cpp1.c b/rsc/source/rscpp/cpp1.c index e0ae7f5..ff505ca 100644 --- a/rsc/source/rscpp/cpp1.c +++ b/rsc/source/rscpp/cpp1.c @@ -24,11 +24,11 @@ #include "cppdef.h" #include "cpp.h" -FILE *pCppOut = NULL; -FILE *pCppIn = NULL; +FILE* pCppOut = NULL; +FILE* pCppIn = NULL; #if OSL_DEBUG_LEVEL > 1 -FILE *pDefOut = NULL; /* ER evtl. #define's dump */ +FILE* pDefOut = NULL; /* ER evtl. #define's dump */ #endif #ifdef B200 @@ -54,18 +54,18 @@ extern unsigned _heaplen = 30000; * to the current file/macro. infile->parent to the includer, * etc. infile->fd is NULL if this input stream is a macro. */ -int line; /* Current line number */ -int wrongline; /* Force #line to compiler */ -char token[IDMAX + 1]; /* Current input token */ -int errors; /* cpp error counter */ -FILEINFO *infile = NULL; /* Current input file */ +int line; /* Current line number */ +int wrongline; /* Force #line to compiler */ +char token[IDMAX + 1]; /* Current input token */ +int errors; /* cpp error counter */ +FILEINFO* infile = NULL; /* Current input file */ #if OSL_DEBUG_LEVEL > 1 -int debug; /* TRUE if debugging now */ -int bDumpDefs; /* TRUE if #define's dump req. */ +int debug; /* TRUE if debugging now */ +int bDumpDefs; /* TRUE if #define's dump req. */ #ifdef EVALDEFS -int bIsInEval; /* TRUE if #define eval now */ -char EvalBuf[NEVALBUF + 1]; /* evaluation buffer */ -int nEvalOff = 0; /* offset to free buffer pos */ +int bIsInEval; /* TRUE if #define eval now */ +char EvalBuf[NEVALBUF + 1]; /* evaluation buffer */ +int nEvalOff = 0; /* offset to free buffer pos */ #endif #endif /* @@ -78,8 +78,8 @@ int nEvalOff = 0; /* offset to free buffer pos */ * This can be disabled by falsifying rec_recover. (Nothing does this * currently: it is a hook for an eventual invocation flag.) */ -int recursion; /* Infinite recursion counter */ -int rec_recover = TRUE; /* Unwind recursive macros */ +int recursion; /* Infinite recursion counter */ +int rec_recover = TRUE; /* Unwind recursive macros */ /* * instring is set TRUE when a string is scanned. It modifies the @@ -97,8 +97,8 @@ int rec_recover = TRUE; /* Unwind recursive macros */ * instring and inmarcor are parameters to the get() routine which * were made global for speed. */ -int instring = FALSE; /* TRUE if scanning string */ -int inmacro = FALSE; /* TRUE if #defining a macro */ +int instring = FALSE; /* TRUE if scanning string */ +int inmacro = FALSE; /* TRUE if #defining a macro */ /* * work[] and workp are used to store one piece of text in a temporay @@ -109,8 +109,8 @@ int inmacro = FALSE; /* TRUE if #defining a macro */ * data won't be overwritten. The extra byte in the allocation is * needed for string formal replacement. */ -char work[NWORK + 1]; /* Work buffer */ -char *workp; /* Work buffer pointer */ +char work[NWORK + 1]; /* Work buffer */ +char* workp; /* Work buffer pointer */ /* * keepcomments is set TRUE by the -C option. If TRUE, comments @@ -127,10 +127,10 @@ char *workp; /* Work buffer pointer */ * __FILE__, and __DATE__. If nflag > 1, absolutely no symbols * are predefined. */ -int keepcomments = FALSE; /* Write out comments flag */ -int cflag = FALSE; /* -C option (keep comments) */ -int eflag = FALSE; /* -E option (never fail) */ -int nflag = 0; /* -N option (no predefines) */ +int keepcomments = FALSE; /* Write out comments flag */ +int cflag = FALSE; /* -C option (keep comments) */ +int eflag = FALSE; /* -E option (never fail) */ +int nflag = 0; /* -N option (no predefines) */ /* * ifstack[] holds information about nested #if's. It is always @@ -141,15 +141,15 @@ int nflag = 0; /* -N option (no predefines) */ * ifstack[0] holds the compiling flag. It is TRUE if compilation * is currently enabled. Note that this must be initialized TRUE. */ -char ifstack[BLK_NEST] = { TRUE }; /* #if information */ -char *ifptr = ifstack; /* -> current ifstack[] */ +char ifstack[BLK_NEST] = { TRUE }; /* #if information */ +char* ifptr = ifstack; /* -> current ifstack[] */ /* * incdir[] stores the -i directories (and the system-specific * #include <...> directories. */ -char *incdir[NINCLUDE]; /* -i directories */ -char **incend = incdir; /* -> free space in incdir[] */ +char* incdir[NINCLUDE]; /* -i directories */ +char** incend = incdir; /* -> free space in incdir[] */ /* * This is the table used to predefine target machine and operating @@ -157,7 +157,8 @@ char **incend = incdir; /* -> free space in incdir[] */ * Note: it is not clear that this is part of the Ansi Standard. * The -N option suppresses preset definitions. */ -char *preset[] = { /* names defined at cpp start */ +char* preset[] = +{ /* names defined at cpp start */ #ifdef MACHINE MACHINE, #endif @@ -177,13 +178,14 @@ char *preset[] = { /* names defined at cpp start */ * The value of these predefined symbols must be recomputed whenever * they are evaluated. The order must not be changed. */ -char *magic[] = { /* Note: order is important */ +char* magic[] = +{ /* Note: order is important */ "__LINE__", "__FILE__", NULL /* Must be last */ }; -static char *sharpfilename = NULL; +static char* sharpfilename = NULL; int nRunde = 0; @@ -230,363 +232,385 @@ void InitCpp1() int MAIN(int argc, char** argv) { - int i; - char **useargv, **pfargv; - - -if( nRunde == 0 ) -{ - pCppIn = stdin; - pCppOut = stdout; -} - -nRunde++; - InitCpp1(); - InitCpp2(); - InitCpp3(); - InitCpp4(); - InitCpp5(); - InitCpp6(); + int i; + char** useargv; + char** pfargv; + + if( nRunde == 0 ) + { + pCppIn = stdin; + pCppOut = stdout; + } + + nRunde++; + InitCpp1(); + InitCpp2(); + InitCpp3(); + InitCpp4(); + InitCpp5(); + InitCpp6(); #if HOST == SYS_VMS - argc = getredirection(argc, argv); /* vms >file and <file */ + argc = getredirection(argc, argv); /* vms >file and <file */ #endif - initdefines(); /* O.S. specific def's */ - if ( argv[argc-1][0] == '@' ) - { - i = readoptions( argv[1], &pfargv ); /* Command file */ - useargv=pfargv; - } - else - { - i = dooptions(argc, argv); /* Command line -flags */ - useargv=argv; - } - switch (i) { + initdefines(); /* O.S. specific def's */ + if ( argv[argc-1][0] == '@' ) + { + i = readoptions( argv[1], &pfargv ); /* Command file */ + useargv=pfargv; + } + else + { + i = dooptions(argc, argv); /* Command line -flags */ + useargv=argv; + } + switch (i) + { #if OSL_DEBUG_LEVEL > 1 - case 4: - if ( bDumpDefs ) - { - /* - * Get defBase file, "-" means use stdout. - */ - if (!streq(useargv[3], "-")) { -#if HOST == SYS_VMS - /* - * On vms, reopen stdout with "vanilla rms" attributes. - */ - if ((i = creat(useargv[3], 0, "rat=cr", "rfm=var")) == -1 - || dup2(i, fileno(stdout)) == -1) { -#else - pDefOut = fopen( useargv[3], "w" ); - if( pDefOut == NULL ) { -#endif - perror(useargv[3]); - cerror("Can't open output file \"%s\"", useargv[3]); - exit(IO_ERROR); - } - } /* Continue by opening output */ - } -#endif - case 3: + case 4: + if ( bDumpDefs ) + { /* - * Get output file, "-" means use stdout. + * Get defBase file, "-" means use stdout. */ - if (!streq(useargv[2], "-")) { + if (!streq(useargv[3], "-")) + { #if HOST == SYS_VMS /* * On vms, reopen stdout with "vanilla rms" attributes. */ - if ((i = creat(useargv[2], 0, "rat=cr", "rfm=var")) == -1 - || dup2(i, fileno(stdout)) == -1) { + if ((i = creat(useargv[3], 0, "rat=cr", "rfm=var")) == -1 + || dup2(i, fileno(stdout)) == -1) #else - pCppOut = fopen( useargv[2], "w" ); - if( pCppOut == NULL ) { + pDefOut = fopen( useargv[3], "w" ); + if( pDefOut == NULL ) #endif - perror(useargv[2]); - cerror("Can't open output file \"%s\"", useargv[2]); + { + perror(useargv[3]); + cerror("Can't open output file \"%s\"", useargv[3]); exit(IO_ERROR); } - } /* Continue by opening input */ - case 2: /* One file -> stdin */ + } /* Continue by opening output */ + } +#endif + case 3: + /* + * Get output file, "-" means use stdout. + */ + if (!streq(useargv[2], "-")) + { +#if HOST == SYS_VMS /* - * Open input file, "-" means use stdin. + * On vms, reopen stdout with "vanilla rms" attributes. */ - if (!streq(useargv[1], "-")) { - pCppIn = fopen( useargv[1], "r" ); - if( pCppIn == NULL) { - perror(useargv[1]); - cerror("Can't open input file \"%s\"", useargv[1]); - exit(IO_ERROR); - } - strcpy(work, useargv[1]); /* Remember input filename */ - break; - } /* Else, just get stdin */ - case 0: /* No args? */ - case 1: /* No files, stdin -> stdout */ -#if (HOST == SYS_UNIX) || (HOST == SYS_UNKNOWN) - work[0] = EOS; /* Unix can't find stdin name */ + if ((i = creat(useargv[2], 0, "rat=cr", "rfm=var")) == -1 + || dup2(i, fileno(stdout)) == -1) #else - fgetname(stdin, work); /* Vax-11C, Decus C know name */ + pCppOut = fopen( useargv[2], "w" ); + if( pCppOut == NULL ) #endif + { + perror(useargv[2]); + cerror("Can't open output file \"%s\"", useargv[2]); + exit(IO_ERROR); + } + } /* Continue by opening input */ + case 2: /* One file -> stdin */ + /* + * Open input file, "-" means use stdin. + */ + if (!streq(useargv[1], "-")) + { + pCppIn = fopen( useargv[1], "r" ); + if( pCppIn == NULL) + { + perror(useargv[1]); + cerror("Can't open input file \"%s\"", useargv[1]); + exit(IO_ERROR); + } + strcpy(work, useargv[1]); /* Remember input filename */ break; + } /* Else, just get stdin */ + case 0: /* No args? */ + case 1: /* No files, stdin -> stdout */ +#if (HOST == SYS_UNIX) || (HOST == SYS_UNKNOWN) + work[0] = EOS; /* Unix can't find stdin name */ +#else + fgetname(stdin, work); /* Vax-11C, Decus C know name */ +#endif + break; - default: - exit(IO_ERROR); /* Can't happen */ - } + default: + exit(IO_ERROR); /* Can't happen */ + } - setincdirs(); /* Setup -I include directories */ - addfile( pCppIn, work); /* "open" main input file */ + setincdirs(); /* Setup -I include directories */ + addfile( pCppIn, work); /* "open" main input file */ #if OSL_DEBUG_LEVEL > 1 - if (debug > 0 || bDumpDefs) - dumpdef("preset #define symbols"); + if (debug > 0 || bDumpDefs) + dumpdef("preset #define symbols"); #endif - if( pCppIn != stdin ) - rewind( pCppIn ); + if( pCppIn != stdin ) + rewind( pCppIn ); - cppmain(); /* Process main file */ + cppmain(); /* Process main file */ - if ((i = (ifptr - &ifstack[0])) != 0) { + if ((i = (ifptr - &ifstack[0])) != 0) + { #if OLD_PREPROCESSOR - ciwarn("Inside #ifdef block at end of input, depth = %d", i); + ciwarn("Inside #ifdef block at end of input, depth = %d", i); #else - cierror("Inside #ifdef block at end of input, depth = %d", i); + cierror("Inside #ifdef block at end of input, depth = %d", i); #endif - } + } #if OSL_DEBUG_LEVEL > 1 - if( pDefOut != stdout && pDefOut != stderr ) - fclose( pDefOut ); + if( pDefOut != stdout && pDefOut != stderr ) + fclose( pDefOut ); #endif - if( pCppOut != stdout && pCppOut != stderr ) - fclose( pCppOut ); + if( pCppOut != stdout && pCppOut != stderr ) + fclose( pCppOut ); - if (errors > 0) { - fprintf(stderr, (errors == 1) + if (errors > 0) + { + fprintf(stderr, (errors == 1) ? "%d error in preprocessor\n" : "%d errors in preprocessor\n", errors); - if (!eflag) - exit(IO_ERROR); - } + if (!eflag) + exit(IO_ERROR); + } #ifdef NOMAIN /* BP */ /* kein exit im der LIB-Version */ - return( IO_NORMAL ); + return( IO_NORMAL ); #else - exit(IO_NORMAL); /* No errors or -E option set */ + exit(IO_NORMAL); /* No errors or -E option set */ #endif } -FILE_LOCAL -void cppmain() /* * Main process for cpp -- copies tokens from the current input * stream (main file, include file, or a macro) to the output * file. */ +void cppmain() { - int c; /* Current character */ - int counter; /* newlines and spaces */ - - /* - * Explicitly output a #line at the start of cpp output so - * that lint (etc.) knows the name of the original source - * file. If we don't do this explicitly, we may get - * the name of the first #include file instead. - * We also seem to need a blank line following that first #line. - */ + int c; /* Current character */ + int counter; /* newlines and spaces */ + + /* + * Explicitly output a #line at the start of cpp output so + * that lint (etc.) knows the name of the original source + * file. If we don't do this explicitly, we may get + * the name of the first #include file instead. + * We also seem to need a blank line following that first #line. + */ #ifdef EVALDEFS - if ( !bIsInEval ) + if ( !bIsInEval ) #endif - { - sharp(); - PUTCHAR('\n'); + { + sharp(); + PUTCHAR('\n'); + } + /* + * This loop is started "from the top" at the beginning of each line + * wrongline is set TRUE in many places if it is necessary to write + * a #line record. (But we don't write them when expanding macros.) + * + * The counter variable has two different uses: at + * the start of a line, it counts the number of blank lines that + * have been skipped over. These are then either output via + * #line records or by outputting explicit blank lines. + * When expanding tokens within a line, the counter remembers + * whether a blank/tab has been output. These are dropped + * at the end of the line, and replaced by a single blank + * within lines. + */ + for (;;) + { + counter = 0; /* Count empty lines */ + for (;;) + { /* For each line, ... */ + while (type[(c = get())] == SPA) /* Skip leading blanks */ + ; /* in this line. */ + if (c == '\n') /* If line's all blank, */ + ++counter; /* Do nothing now */ + else if (c == '#') + { /* Is 1st non-space '#' */ + keepcomments = FALSE; /* Don't pass comments */ + counter = control(counter); /* Yes, do a #command */ + keepcomments = (cflag && compiling); + } + else if (c == EOF_CHAR) /* At end of file? */ + { + break; + } + else if (!compiling) + { /* #ifdef false? */ + skipnl(); /* Skip to newline */ + counter++; /* Count it, too. */ + } + else + { + break; /* Actual token */ + } } + if (c == EOF_CHAR) /* Exit process at */ + break; /* End of file */ /* - * This loop is started "from the top" at the beginning of each line - * wrongline is set TRUE in many places if it is necessary to write - * a #line record. (But we don't write them when expanding macros.) - * - * The counter variable has two different uses: at - * the start of a line, it counts the number of blank lines that - * have been skipped over. These are then either output via - * #line records or by outputting explicit blank lines. - * When expanding tokens within a line, the counter remembers - * whether a blank/tab has been output. These are dropped - * at the end of the line, and replaced by a single blank - * within lines. + * If the loop didn't terminate because of end of file, we + * know there is a token to compile. First, clean up after + * absorbing newlines. counter has the number we skipped. */ - for (;;) { - counter = 0; /* Count empty lines */ - for (;;) { /* For each line, ... */ - while (type[(c = get())] == SPA) /* Skip leading blanks */ - ; /* in this line. */ - if (c == '\n') /* If line's all blank, */ - ++counter; /* Do nothing now */ - else if (c == '#') { /* Is 1st non-space '#' */ - keepcomments = FALSE; /* Don't pass comments */ - counter = control(counter); /* Yes, do a #command */ - keepcomments = (cflag && compiling); - } - else if (c == EOF_CHAR) /* At end of file? */ + if ((wrongline && infile->fp != NULL) || counter > 4) + sharp(); /* Output # line number */ + else + { /* If just a few, stuff */ + while (--counter >= 0) /* them out ourselves */ + PUTCHAR('\n'); + } + /* + * Process each token on this line. + */ + unget(); /* Reread the char. */ + for (;;) + { /* For the whole line, */ + do + { /* Token concat. loop */ + for (counter = 0; type[(c = get())] == SPA;) { - break; - } - else if (!compiling) { /* #ifdef false? */ - skipnl(); /* Skip to newline */ - counter++; /* Count it, too. */ - } - else { - break; /* Actual token */ - } - } - if (c == EOF_CHAR) /* Exit process at */ - break; /* End of file */ - /* - * If the loop didn't terminate because of end of file, we - * know there is a token to compile. First, clean up after - * absorbing newlines. counter has the number we skipped. - */ - if ((wrongline && infile->fp != NULL) || counter > 4) - sharp(); /* Output # line number */ - else { /* If just a few, stuff */ - while (--counter >= 0) /* them out ourselves */ - PUTCHAR('\n'); - } - /* - * Process each token on this line. - */ - unget(); /* Reread the char. */ - for (;;) { /* For the whole line, */ - do { /* Token concat. loop */ - for (counter = 0; type[(c = get())] == SPA;) { #if COMMENT_INVISIBLE - if (c != COM_SEP) - counter++; -#else - counter++; /* Skip over blanks */ + if (c != COM_SEP) #endif - } - if (c == EOF_CHAR || c == '\n') - goto end_line; /* Exit line loop */ - else if (counter > 0) /* If we got any spaces */ - PUTCHAR(' '); /* Output one space */ - c = macroid(c); /* Grab the token */ - } while (type[c] == LET && catenate()); - if (c == EOF_CHAR || c == '\n') /* From macro exp error */ - goto end_line; /* Exit line loop */ - switch (type[c]) { - case LET: - fputs(token, pCppOut); /* Quite ordinary token */ + counter++; /* Skip over blanks */ + + } + if (c == EOF_CHAR || c == '\n') + goto end_line; /* Exit line loop */ + else if (counter > 0) /* If we got any spaces */ + PUTCHAR(' '); /* Output one space */ + c = macroid(c); /* Grab the token */ + } + while (type[c] == LET && catenate()); + + if (c == EOF_CHAR || c == '\n') /* From macro exp error */ + goto end_line; /* Exit line loop */ + + switch (type[c]) + { + case LET: + fputs(token, pCppOut); /* Quite ordinary token */ #ifdef EVALDEFS + { + int len; + if ( bIsInEval + && nEvalOff + (len=strlen(token)) < NEVALBUF ) { - int len; - if ( bIsInEval - && nEvalOff + (len=strlen(token)) < NEVALBUF ) - { - strcpy( &EvalBuf[nEvalOff], token ); - nEvalOff += len; - } + strcpy( &EvalBuf[nEvalOff], token ); + nEvalOff += len; } + } #endif - break; + break; - case DIG: /* Output a number */ - case DOT: /* Dot may begin floats */ + case DIG: /* Output a number */ + case DOT: /* Dot may begin floats */ #ifdef EVALDEFS - if ( bIsInEval ) - scannumber(c, outputEval); - else - scannumber(c, output); -#else + if ( bIsInEval ) + scannumber(c, outputEval); + else scannumber(c, output); +#else + scannumber(c, output); #endif - break; + break; - case QUO: /* char or string const */ - scanstring(c, output); /* Copy it to output */ - break; + case QUO: /* char or string const */ + scanstring(c, output); /* Copy it to output */ + break; - default: /* Some other character */ - cput(c); /* Just output it */ + default: /* Some other character */ + cput(c); /* Just output it */ #ifdef EVALDEFS - if ( bIsInEval && nEvalOff < NEVALBUF ) - EvalBuf[nEvalOff++] = c; + if ( bIsInEval && nEvalOff < NEVALBUF ) + EvalBuf[nEvalOff++] = c; #endif - break; - } /* Switch ends */ - } /* Line for loop */ -end_line: if (c == '\n') { /* Compiling at EOL? */ - PUTCHAR('\n'); /* Output newline, if */ - if (infile->fp == NULL) /* Expanding a macro, */ - wrongline = TRUE; /* Output # line later */ - } - } /* Continue until EOF */ + break; + } /* Switch ends */ + } /* Line for loop */ + end_line: + if (c == '\n') + { /* Compiling at EOL? */ + PUTCHAR('\n'); /* Output newline, if */ + if (infile->fp == NULL) /* Expanding a macro, */ + wrongline = TRUE; /* Output # line later */ + } + } /* Continue until EOF */ #ifdef EVALDEFS - if ( bIsInEval ) - EvalBuf[nEvalOff++] = '\0'; + if ( bIsInEval ) + EvalBuf[nEvalOff++] = '\0'; #endif } -void output(int c) /* * Output one character to stdout -- output() is passed as an * argument to scanstring() */ +void output(int c) { #if COMMENT_INVISIBLE - if (c != TOK_SEP && c != COM_SEP) + if (c != TOK_SEP && c != COM_SEP) #else - if (c != TOK_SEP) + if (c != TOK_SEP) #endif - PUTCHAR(c); + PUTCHAR(c); } #ifdef EVALDEFS -outputEval(c) -int c; /* * Output one character to stdout -- output() is passed as an * argument to scanstring() */ +int outputEval(int c) { #if COMMENT_INVISIBLE - if (c != TOK_SEP && c != COM_SEP) + if (c != TOK_SEP && c != COM_SEP) #else - if (c != TOK_SEP) + if (c != TOK_SEP) #endif - { - PUTCHAR(c); - if ( bIsInEval && nEvalOff < NEVALBUF ) - EvalBuf[nEvalOff++] = c; - } + { + PUTCHAR(c); + if ( bIsInEval && nEvalOff < NEVALBUF ) + EvalBuf[nEvalOff++] = c; + } } #endif -FILE_LOCAL -void sharp() /* * Output a line number line. */ +void sharp() { - char *name; - - if (keepcomments) /* Make sure # comes on */ - PUTCHAR('\n'); /* a fresh, new line. */ - fprintf( pCppOut, "#%s %d", LINE_PREFIX, line); - if (infile->fp != NULL) { - name = (infile->progname != NULL) - ? infile->progname : infile->filename; - if (sharpfilename == NULL - || (sharpfilename != NULL && !streq(name, sharpfilename)) ) { - if (sharpfilename != NULL) - free(sharpfilename); - sharpfilename = savestring(name); - fprintf( pCppOut, " \"%s\"", name); - } + char* name; + + if (keepcomments) /* Make sure # comes on */ + PUTCHAR('\n'); /* a fresh, new line. */ + + fprintf( pCppOut, "#%s %d", LINE_PREFIX, line); + if (infile->fp != NULL) + { + name = (infile->progname != NULL) ? infile->progname : infile->filename; + if (sharpfilename == NULL || + (sharpfilename != NULL && !streq(name, sharpfilename))) + { + if (sharpfilename != NULL) + free(sharpfilename); + sharpfilename = savestring(name); + fprintf( pCppOut, " \"%s\"", name); } - PUTCHAR('\n'); - wrongline = FALSE; + } + PUTCHAR('\n'); + wrongline = FALSE; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit aa43602493675baebeff028d66c9aa39a555ac7f Author: Norbert Thiebaud <[email protected]> Date: Sat Jul 5 21:41:26 2014 +0200 coverity#983493 String Overflow Change-Id: I31a167508ca33e8d6ccc13690c013c39566b9447 diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx index abe4bc9..0a0ba02 100644 --- a/sal/osl/unx/process.cxx +++ b/sal/osl/unx/process.cxx @@ -124,23 +124,26 @@ static oslProcessError SAL_CALL osl_searchPath_impl(const sal_Char* pszName, *pstr++ = '/'; *pstr = '\0'; + size_t reminder = PATH_MAX - strlen(path); + if(reminder > strlen(pszName)) + { + strncat(path, pszName, reminder); - strcat(path, pszName); + if (access(path, 0) == 0) + { + char szRealPathBuf[PATH_MAX + 1] = ""; - if (access(path, 0) == 0) - { - char szRealPathBuf[PATH_MAX] = ""; + if( NULL == realpath(path, szRealPathBuf) || (strlen(szRealPathBuf) >= (sal_uInt32)Max)) + return osl_Process_E_Unknown; - if( NULL == realpath(path, szRealPathBuf) || (strlen(szRealPathBuf) >= (sal_uInt32)Max)) - return osl_Process_E_Unknown; + strcpy(pszBuffer, path); - strcpy(pszBuffer, path); + return osl_Process_E_None; + } - return osl_Process_E_None; + if (*pchr == ':') + pchr++; } - - if (*pchr == ':') - pchr++; } } commit ce55457a8fb065a1cd0796d3e748e6133a551a39 Author: Norbert Thiebaud <[email protected]> Date: Sat Jul 5 21:23:04 2014 +0200 coverity#708787 Unused pointr value Change-Id: Ib1b0dd07be41d382fa24edbb37d30cbe9ea193fa diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 5192dee..f4e84dc 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -1595,7 +1595,7 @@ bool ORowSetCache::checkJoin(const Reference< XConnection>& _xConnection, if(bCheck) { // here we know that we have to check on which side our table resides - const OSQLParseNode* pTableRef = pJoin->getByRule(::connectivity::OSQLParseNode::qualified_join); + const OSQLParseNode* pTableRef; if(bLeftSide) pTableRef = pJoin->getChild(0); else _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
