| Newsgroups |
gmane.comp.db.tds.freetds |
| Message-ID |
<66607689AF9BB243B6C00BC05B4AFE6E0E2F0CC85B@LDNPCMMGMB05.INTRANET.BARCAPINT.COM> |
I agree. There are still two options, though:
1) change the patch as so:
--- src\src\ctlib\cs#1.c 2014-02-07 13:51:17.000000000 +-0100
+++ src\src\ctlib\cs.c 2014-02-07 13:49:45.000000000 +-0100
@@ -566,12 +566,16 @@
destdata = destvc->str;
}
tdsdump_log(TDS_DBG_FUNC, "converting type %d (%d bytes) to type = %d (%d bytes)\n",
src_type, src_len, desttype, destlen);
+ if (is_numeric_type(desttype)) {
+ destlen = 35;
+ }
+
if (!is_fixed_type(desttype) && (destlen <= 0)) {
return CS_FAIL;
}
dest = (unsigned char *) destdata;
OR
2) Blame the caller (DBD-Sybase in this case). The documentation suggests that
filling in maxlen is a precondition for cs_convert(). Maybe I should submit
a patch to DBD-Sybase instead (see to_numeric() in dbdimp.c). What do you
think?
Thanks,
Sam
2014-02-05
> Hi,
> good spot!
>
> Documentation state (destfmt->maxlength,
> http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.mainframeconnect_12.6.occprc/html/occprc/X12978.htm):
>
> dest_maxlen = 35 when converting to numeric or Sybase-decimal.
>
> I think that in case you are converting numeric->numeric and you have
> destlen < 0 with your patch code can core trying to do a memcpy(dest,
> src, destlen).
>
> Perhaps it's better to just set destlen to 35 before the test for
> destlen<=0 is done.
>
> Feel free to send patches in whatever format. Obviously if you want a
> specific format, specific name in the patch you should send these
> data.
>
> Frediano
_______________________________________________
This message is for information purposes only, it is not a recommendation, advice, offer or solicitation to buy or sell a product or service nor an official confirmation of any transaction. It is directed at persons who are professionals and is not intended for retail customer use. Intended for recipient only. This message is subject to the terms at: www.barclays.com/emaildisclaimer.
For important disclosures, please see: www.barclays.com/salesandtradingdisclaimer regarding market commentary from Barclays Sales and/or Trading, who are active market participants; and in respect of Barclays Research, including disclosures relating to specific issuers, please see http://publicresearch.barclays.com.
_______________________________________________