mirror of https://gerrit.osmocom.org/libtelnet
Merge branch 'master' of github.com:elanthis/libtelnet
This commit is contained in:
commit
048b3b2d42
10
libtelnet.c
10
libtelnet.c
|
@ -241,8 +241,8 @@ static INLINE void _set_rfc1143(telnet_t *telnet, unsigned char telopt,
|
||||||
* to the number of enabled options for most simple code, and it
|
* to the number of enabled options for most simple code, and it
|
||||||
* allows for an acceptable number of reallocations for complex code.
|
* allows for an acceptable number of reallocations for complex code.
|
||||||
*/
|
*/
|
||||||
if ((qtmp = (telnet_rfc1143_t *)realloc(telnet->q, sizeof(
|
if ((qtmp = (telnet_rfc1143_t *)realloc(telnet->q,
|
||||||
telnet_rfc1143_t) * (telnet->q_size + 1))) == 0) {
|
sizeof(telnet_rfc1143_t) * (telnet->q_size + 4))) == 0) {
|
||||||
_error(telnet, __LINE__, __func__, TELNET_ENOMEM, 0,
|
_error(telnet, __LINE__, __func__, TELNET_ENOMEM, 0,
|
||||||
"malloc() failed: %s", strerror(errno));
|
"malloc() failed: %s", strerror(errno));
|
||||||
return;
|
return;
|
||||||
|
@ -932,7 +932,7 @@ void telnet_send(telnet_t *telnet, const char *buffer,
|
||||||
|
|
||||||
for (l = i = 0; i != size; ++i) {
|
for (l = i = 0; i != size; ++i) {
|
||||||
/* dump prior portion of text, send escaped bytes */
|
/* dump prior portion of text, send escaped bytes */
|
||||||
if (buffer[i] == TELNET_IAC) {
|
if (buffer[i] == (char)TELNET_IAC) {
|
||||||
/* dump prior text if any */
|
/* dump prior text if any */
|
||||||
if (i != l)
|
if (i != l)
|
||||||
_send(telnet, buffer + l, i - l);
|
_send(telnet, buffer + l, i - l);
|
||||||
|
@ -1017,7 +1017,7 @@ int telnet_printf(telnet_t *telnet, const char *fmt, ...) {
|
||||||
/* send */
|
/* send */
|
||||||
for (l = i = 0; i != rs; ++i) {
|
for (l = i = 0; i != rs; ++i) {
|
||||||
/* special characters */
|
/* special characters */
|
||||||
if (buffer[i] == TELNET_IAC || buffer[i] == '\r' ||
|
if (buffer[i] == (char)TELNET_IAC || buffer[i] == '\r' ||
|
||||||
buffer[i] == '\n') {
|
buffer[i] == '\n') {
|
||||||
/* dump prior portion of text */
|
/* dump prior portion of text */
|
||||||
if (i != l)
|
if (i != l)
|
||||||
|
@ -1025,7 +1025,7 @@ int telnet_printf(telnet_t *telnet, const char *fmt, ...) {
|
||||||
l = i + 1;
|
l = i + 1;
|
||||||
|
|
||||||
/* IAC -> IAC IAC */
|
/* IAC -> IAC IAC */
|
||||||
if (buffer[i] == TELNET_IAC)
|
if (buffer[i] == (char)TELNET_IAC)
|
||||||
telnet_iac(telnet, TELNET_IAC);
|
telnet_iac(telnet, TELNET_IAC);
|
||||||
/* automatic translation of \r -> CRNUL */
|
/* automatic translation of \r -> CRNUL */
|
||||||
else if (buffer[i] == '\r')
|
else if (buffer[i] == '\r')
|
||||||
|
|
Loading…
Reference in New Issue