Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3f94bc1

Browse files
committed
Correct off-by-one error in strncat() usage.
1 parent 7fbf0af commit 3f94bc1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/interfaces/odbc/convert.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,9 @@ int lobj_fd, retval;
688688

689689
oldstmtlen = strlen(old_statement);
690690

691-
for (opos = 0; opos < oldstmtlen; opos++) {
691+
for (opos = 0; opos < oldstmtlen; opos++) {
692692

693-
// Squeeze carriage-returns/linfeed pairs to linefeed only
693+
// Squeeze carriage-return/linefeed pairs to linefeed only
694694
if (old_statement[opos] == '\r' && opos+1 < oldstmtlen &&
695695
old_statement[opos+1] == '\n') {
696696
continue;
@@ -1156,7 +1156,7 @@ char key[33];
11561156
*funcEnd = svchar;
11571157
while ((*funcEnd != '\0') && isspace(*funcEnd)) funcEnd++;
11581158

1159-
/* We expect left parenthensis here,
1159+
/* We expect left parenthesis here,
11601160
* else return fn body as-is since it is
11611161
* one of those "function constants".
11621162
*/
@@ -1175,7 +1175,7 @@ char key[33];
11751175
}
11761176
/* copy mapped name and remaining input string */
11771177
strcpy(escape, mapFunc);
1178-
strncat(escape, funcEnd, sizeof(escape)-strlen(mapFunc));
1178+
strncat(escape, funcEnd, sizeof(escape)-1-strlen(mapFunc));
11791179
}
11801180
else {
11811181
/* Bogus key, leave untranslated */

0 commit comments

Comments
 (0)