Skip to content

Commit c5e073c

Browse files
committed
ecpg: Fix off-by-one error in memory copying
In a rare case, one byte past the end of memory belonging to the sqlca_t structure would be written to. found by Coverity
1 parent 8dd4d10 commit c5e073c

File tree

1 file changed

+1
-1
lines changed
  • src/interfaces/ecpg/ecpglib

1 file changed

+1
-1
lines changed

src/interfaces/ecpg/ecpglib/misc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ ECPGset_var(int number, void *pointer, int lineno)
525525
struct sqlca_t *sqlca = ECPGget_sqlca();
526526

527527
sqlca->sqlcode = ECPG_OUT_OF_MEMORY;
528-
strncpy(sqlca->sqlstate, "YE001", sizeof("YE001"));
528+
strncpy(sqlca->sqlstate, "YE001", sizeof(sqlca->sqlstate));
529529
snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), "out of memory on line %d", lineno);
530530
sqlca->sqlerrm.sqlerrml = strlen(sqlca->sqlerrm.sqlerrmc);
531531
/* free all memory we have allocated for the user */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy