[Bug 1090] Increase MAX_SESSIONS?
bugzilla-daemon at mindrot.org
bugzilla-daemon at mindrot.org
Mon Oct 3 13:37:35 EST 2005
http://bugzilla.mindrot.org/show_bug.cgi?id=1090
------- Additional Comments From dtucker at zip.com.au 2005-10-03 13:37 -------
(From update of attachment 963)
Personally, I have no objection to this in principle.
Some comments on the patch:
>+ num_sessions=1;
I'd be tempted to allocate them in blocks (eg of 8) to avoid excessive reallocs
but that's not critical.
>+ sessions=calloc(num_sessions,sizeof(sessions[0]));
Since sessions is initialized as NULL, could you use xrealloc (which is
guaranteed to be happy with xrealloc(NULL, size)) rather than calloc/realloc to
simplify this?
>+ Session *n=realloc(sessions,++num_sessions*sizeof(Session));
>+ if (!n)
>+ return NULL;
If the realloc fails you will have already incremented num_sessions, so the
next new channel will overflow the array bounds.
Along similar lines: it's unlikely but what's to prevent num_sessions exceeding
INT_MAX and wrapping when MaxSessions=0 and you have gobs of memory?
>+ sessions=n;
>+ s=sessions+num_sessions-1;
The rest of the function uses array syntax, it's probably easier to follow if
you stick to that. "s = sessions[i]" would be right, no?
>+.It Cm MaxSession
Should be "MaxSessions"?.
There were a few style nits too but they're not a big deal.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the openssh-bugs
mailing list