-/* $OpenBSD: connection.c,v 1.13 2011/05/04 21:00:04 claudio Exp $ */
+/* $OpenBSD: connection.c,v 1.14 2014/04/20 16:49:56 claudio Exp $ */
/*
* Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org>
size_t i = 0;
if (s->mine.MaxConnections != iscsi_sess_defaults.MaxConnections) {
- i++;
if (kvp && i < *nkvp) {
kvp[i].key = strdup("MaxConnections");
if (kvp[i].key == NULL)
return (-1);
- if (asprintf(&kvp[i].value, "%u",
- (unsigned int)s->mine.MaxConnections) == -1) {
+ if (asprintf(&kvp[i].value, "%hu",
+ s->mine.MaxConnections) == -1) {
kvp[i].value = NULL;
return (-1);
}
}
+ i++;
}
if (c->mine.MaxRecvDataSegmentLength !=
iscsi_conn_defaults.MaxRecvDataSegmentLength) {
- i++;
if (kvp && i < *nkvp) {
kvp[i].key = strdup("MaxRecvDataSegmentLength");
if (kvp[i].key == NULL)
return (-1);
if (asprintf(&kvp[i].value, "%u",
- (unsigned int)c->mine.MaxRecvDataSegmentLength) == -1) {
+ c->mine.MaxRecvDataSegmentLength) == -1) {
kvp[i].value = NULL;
return (-1);
}
}
+ i++;
}
*nkvp = i;
-/* $OpenBSD: initiator.c,v 1.11 2014/04/19 18:31:33 claudio Exp $ */
+/* $OpenBSD: initiator.c,v 1.12 2014/04/20 16:49:56 claudio Exp $ */
/*
* Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org>
case ISCSI_LOGIN_STG_OPNEG:
if (conn_gen_kvp(c, NULL, &nkvp) == -1)
return NULL;
+ nkvp += 1; /* add slot for terminator */
if (!(kvp = calloc(nkvp, sizeof(*kvp))))
return NULL;
if (conn_gen_kvp(c, kvp, &nkvp) == -1) {