| 2138 } |
2138 } |
| 2139 |
2139 |
| 2140 /* Null terminate */ |
2140 /* Null terminate */ |
| 2141 session->rxbuf[session->rxoff + n] = 0; |
2141 session->rxbuf[session->rxoff + n] = 0; |
| 2142 |
2142 |
| |
2143 #ifdef MSIM_CHECK_EMBEDDED_NULLS |
| 2143 /* Check for embedded NULs. I don't handle them, and they shouldn't occur. */ |
2144 /* Check for embedded NULs. I don't handle them, and they shouldn't occur. */ |
| 2144 if (strlen(session->rxbuf + session->rxoff) != n) |
2145 if (strlen(session->rxbuf + session->rxoff) != n) |
| 2145 { |
2146 { |
| 2146 /* Occurs after login, but it is not a null byte. */ |
2147 /* Occurs after login, but it is not a null byte. */ |
| 2147 purple_debug_info("msim", "msim_input_cb: strlen=%d, but read %d bytes" |
2148 purple_debug_info("msim", "msim_input_cb: strlen=%d, but read %d bytes" |
| 2148 "--null byte encountered?\n", |
2149 "--null byte encountered?\n", |
| 2149 strlen(session->rxbuf + session->rxoff), n); |
2150 strlen(session->rxbuf + session->rxoff), n); |
| 2150 //purple_connection_error(gc, "Invalid message - null byte on input"); |
2151 //purple_connection_error(gc, "Invalid message - null byte on input"); |
| 2151 return; |
2152 return; |
| 2152 } |
2153 } |
| |
2154 #endif |
| 2153 |
2155 |
| 2154 session->rxoff += n; |
2156 session->rxoff += n; |
| 2155 purple_debug_info("msim", "msim_input_cb: read=%d\n", n); |
2157 purple_debug_info("msim", "msim_input_cb: read=%d\n", n); |
| 2156 |
2158 |
| 2157 #ifdef MSIM_DEBUG_RXBUF |
2159 #ifdef MSIM_DEBUG_RXBUF |