iscsi-scstd: Make really sure that the buffer allocated for nl_read() is large enough

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4110 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2012-02-04 16:39:26 +00:00
parent fdeea7c916
commit 85b89521f8
+4 -2
View File
@@ -160,7 +160,8 @@ static int handle_e_add_target(int fd, const struct iscsi_kern_event *event)
/* Params are not 0-terminated */
size = NLMSG_ALIGN(strlen("Target ") + event->param1_size + 2 + event->param2_size + 1);
size = strlen("Target ") + event->param1_size + 2 + event->param2_size +
1 + NLMSG_ALIGNTO - 1;
buf = malloc(size);
if (buf == NULL) {
@@ -759,7 +760,8 @@ static int handle_e_set_attr_value(int fd, const struct iscsi_kern_event *event)
}
/* Params are not 0-terminated */
size = NLMSG_ALIGN(event->param1_size + 1 + 1 + event->param2_size + 1);
size = event->param1_size + 1 + 1 + event->param2_size + 1 +
NLMSG_ALIGNTO - 1;
buf = malloc(size);
if (buf == NULL) {