1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-10-01 03:36:26 -04:00

smb: Assert that there is room for a terminating null.

Corresponds to FSP commit 23b4b912ac.
This commit is contained in:
Kalle Olavi Niemitalo 2007-03-05 23:53:26 +02:00 committed by Kalle Olavi Niemitalo
parent 588375444b
commit 846a368fb0

View File

@ -376,6 +376,15 @@ smb_got_error(struct socket *socket, struct read_buffer *rb)
return;
}
/* There should be free space in the buffer, because
* @alloc_read_buffer allocated several kibibytes, and the
* child process wrote only an integer and a newline to the
* pipe. */
assert(rb->freespace >= 1);
if_assert_failed {
abort_connection(conn, S_INTERNAL);
return;
}
rb->data[len] = '\0';
error = atoi(rb->data);
kill_buffer_data(rb, len);