Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/dblib/dblib.c
Original file line number Diff line number Diff line change
Expand Up @@ -6634,6 +6634,7 @@ RETCODE
dbwritetext(DBPROCESS * dbproc, char *objname, DBBINARY * textptr, DBTINYINT textptrlen, DBBINARY * timestamp, DBBOOL log,
DBINT size, BYTE * text)
{
DBINT len = 0;
char textptr_string[35]; /* 16 * 2 + 2 (0x) + 1 */
char timestamp_string[19]; /* 8 * 2 + 2 (0x) + 1 */
TDS_INT result_type;
Expand All @@ -6652,8 +6653,14 @@ dbwritetext(DBPROCESS * dbproc, char *objname, DBBINARY * textptr, DBTINYINT tex
if (textptrlen > DBTXPLEN)
return FAIL;

dbconvert(dbproc, SYBBINARY, (BYTE *) textptr, textptrlen, SYBCHAR, (BYTE *) textptr_string, -1);
dbconvert(dbproc, SYBBINARY, (BYTE *) timestamp, 8, SYBCHAR, (BYTE *) timestamp_string, -1);
len = dbconvert(dbproc, SYBBINARY, (BYTE *) textptr, textptrlen,
SYBCHAR, (BYTE *) textptr_string, -1);
if (len < 0)
return FAIL;
len = dbconvert(dbproc, SYBBINARY, (BYTE *) timestamp, 8, SYBCHAR,
(BYTE *) timestamp_string, -1);
if (len < 0)
return FAIL;
Comment on lines +6656 to +6663
Copy link
Contributor

@freddy77 freddy77 May 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this function cannot fail with these arguments!


dbproc->dbresults_state = _DB_RES_INIT;

Expand Down