SQLDescribeCol can return the length required for the name passing 0 as cbColNameMax. This is not working with current code. Signed-off-by: Frediano Ziglio <email@example.com>
Reported by Richard Hughes. If some kind of quote was embedded into the command FreeTDS would interpret it as string instead of comment.
Calling dbconvert with values <0 for destination length could cause buffer overflows. Compute output length properly to avoid these overflows. Signed-off-by: Frediano Ziglio <firstname.lastname@example.org>
In TDS7+ buffer row contains all blobs while in TDS5 blobs are send after the fixed and variable types. This cause the buffer to require lot of space. Not using buffer but sending directly to the wire avoid these huge allocations. The code was also underestimating the buffer size causing buffer overflow. Signed-off-by: Frediano Ziglio <email@example.com>
…n Ubuntu (and soon in Debian) are configured to fail to resolve references to libraries not explicitly listed on the linker commandline. This patch fixes the build so that whenever we're going to use the symbol from libgcrypt, we also make sure to use the libgcrypt cflags/ldflags. Signed-off-by: Steve Langasek <firstname.lastname@example.org> Signed-off-by: Frediano Ziglio <email@example.com>
Sending store procedure names for internal RPCs the length was not always correct resulting in invalid parameters. Signed-off-by: Frediano Ziglio <firstname.lastname@example.org>
…tting. "required" => "require". "desidered" => "desired".
…rectly. The code treats -d as an alias to -D, but the trailing colon is missing in the getopt string, which means getopt doesn't return the next argument in optarg and the code segfaults instead. Of course, as a result this option has never worked, and it's not documented in usage, so it would be an equally reasonable fix to drop support for -d as an alias. Bug-Debian: http://bugs.debian.org/715697 Bug-Debian: http://bugs.debian.org/715698
If datacopy is called incorrectly with, e.g., /dev/null on stdin, it won't get any database login/password information. We should print an error message and exit instead of throwing a segfault trying to copy a null pointer. Rather than exiting immediately, though, just try to connect to the databases without a username/password, because hey, you never know. Bug-Debian: http://bugs.debian.org/715785
Due to wrong header inclusion order symbols got local binding preventing from linking system functions like strlen. So avoiding including headers while we use hidden visibility using gcc. Fix from Justin T Pryzby Signed-off-by: Frediano Ziglio <email@example.com>
If unknown environment is double byte encoded we must skip 2 bytes so skip considering only token byte length. Signed-off-by: Frediano Ziglio <firstname.lastname@example.org>
Connecting to a different protocol (like MySQL) can lead FreeTDS to crash. This is due on how we deal with packets having a length of 0. In this case code assume that buffer is sufficient but then try to copy 8 bytes into a not allocated (NULL) buffer leading to a core. Prevent this checking for header packet length (which must be >=8). 0.92 has same check. Signed-off-by: Frediano Ziglio <email@example.com>
Do not pass server error values as dblib error ones. Resolve bug #59 reported by Mikhail Teterin. Signed-off-by: Frediano Ziglio <firstname.lastname@example.org>
BCP-copying wide rows (>255 bytes, from file into server-table) results in an error in bcp_sendrow() and a bogus state in Sybase SQL Server. Signed-off-by: Eduard Heimann <email@example.com> Signed-off-by: Frediano Ziglio <firstname.lastname@example.org>
Double iconv is used if system iconv is not able to convert directly from a charset to another. This happen with some iconv implementations (like Solaris or HP-UX). Use always tds_iconv instead of tds_sys_iconv (mainly in tds_iconv_fread). Do not read too much characters in tds_iconv but only required ones to be able to continue reading correctly on next call.