[illumos-Developer] Webrev for bug 1102: Resource exhaustion in sftp client

Gary Mills mills at cc.umanitoba.ca
Sun Jun 19 06:16:26 PDT 2011


On Sat, Jun 18, 2011 at 03:26:15PM -0400, Albert Lee wrote:
> I have some style nits I think are still worth mentioning, even though
> this is foreign code exempt from cstyle. There are indentation
> changes, and a couple of other added return statements which are
> inconsistent with both upstream and illumos/ON style.

I based my changes on the patch for the earliest version of glob.c
that I could find, the netbsd patch.  The glob.c included with the ssh
product is actually a Berkeley version.  This patch seemed to be the
best fit.  I hope that later versions of the product include a fix for
resource exhaustion, clearly a minor problem.  `ssh' contains an
extensive BSD compatibility library.

> e.g.:
> -           newsize + *limitp >= (u_int) get_arg_max()) {
> +               (newsize + limit[GLOB_INDEX_MALLOC]) >= GLOB_LIMIT_MALLOC) {

I didn't want to touch indentation.  The original glob.c had 85 cstyle
violations.  My patched version had the same number.

>                 errno = 0;
> -               return(GLOB_NOSPACE);
> +               return GLOB_NOSPACE;

The original glob.c had 8 instances of `return variable'.  The patch
added 3 more.  The original also had many instances of
`return(variable)' and `return (variable)'.  I'd say that it wasn't
consistent in any way.  I didn't make it any worse.

> (Also seems more natural for GLOB_INDEX_* to be enums).

I agree.  Later versions of glob.c, from openbsd for example, use
a structure with three members for the resource limits.  Unfortunately,
the patch had too many other changes to be suitable for this glob.c

-- 
-Gary Mills-        -Unix Group-        -Computer and Network Services-



More information about the Developer mailing list