<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p><span style="font-size: 10pt;">Hi,</span></p>
<p><br>
<span style="font-size: 10pt;"></span></p>
<p><span style="font-size: 10pt;">We are trying to fetch data from sybase DB through mod lua (in apache 2.4.23) using the freetds(downloaded from
</span></p>
<p><span style="font-size: 10pt;"><a href="https://www.opencsw.org/package/freetds/">https://www.opencsw.org/package/freetds/</a>).<br style="">
<br style="">
OS details is: Oracle Solaris 10 8/11 s10s_u10wos_17b SPARC<br style="">
<br style="">
The lua module receives a key from the http request and looks up for the corresponding value from a sybase database table.<br style="">
The problem is in this database lookup. It's only a plain select query fetching a single value of type varchar.</span></p>
<p><span style="font-size: 10pt;">However, some random characters get appended to the retrieved value at the end when we recieve it in the lua module.<br style="">
<br style="">
We tried to gather a pattern of data for which we encountered the issue. If the character count of the string value that is fetched from DB is exactly 2^n, the data fetched is absolutely fine. Anything greater or less than that is appended with random characters
 at the end. Following are few examples:<br style="">
<br style="">
-- 9 character varchar value in DB -> 0021/2015<br style="">
-- Data received in lua code -> 0021/2015<span style="color: rgb(255, 0, 0);">h</span><br style="">
<br style="">
-- 17 character varchar value in DB -> 0021/2015/06/18/7<br style="">
-- Data received in lua code -> 0021/2015/06/18/7<span style="color: rgb(255, 0, 0);">\x07\xc1\xd4</span><br style="">
<br style="">
-- 33 character varchar value in DB -> 0021/2015/06/18/732/10.1002-2Fabc<br style="">
-- Data received in lua code -> 0021/2015/06/18/732/10.1002-2Fabc<span style="color: rgb(255, 0, 0);">\x02h</span><br style="color: rgb(255, 0, 0);">
<br style="">
-- 65 character varchar value in DB -> 0021/2015/06/18/732/10.1002-2Fab0021/2015/06/18/732/10.1002-2Fabc<br style="">
-- Data received in lua code -> 0021/2015/06/18/732/10.1002-2Fab0021/2015/06/18/732/10.1002-2FabcY<span style="color: rgb(255, 0, 0);">\x140</span><br style="">
<br style="">
Please note the following:<br style="">
1. The issue do not happen in a RHEL system<br style="">
2. The same functionality works fine if we lookup a similar table in MySQL.</span></p>
<p><br>
<span style="font-size: 10pt;"></span></p>
<p><span style="font-size: 10pt;">Any comments regarding the cause of this issue would be really helpful.<br style="">
</span></p>
<p><br>
</p>
<div id="Signature">
<div class="BodyFragment"><font size="2">
<div class="PlainText">Thanks & Regards,<br>
Krishna Upadhyay<br>
Tata Consultancy Services<br>
</div>
</font></div>
</div>
</body>
</html>