Print this page
10118 libeti() NULL check after deref

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libeti/form/common/field.c
          +++ new/usr/src/lib/libeti/form/common/field.c
↓ open down ↓ 20 lines elided ↑ open up ↑
  21   21   */
  22   22  /*      Copyright (c) 1988 AT&T */
  23   23  /*        All Rights Reserved   */
  24   24  
  25   25  
  26   26  /*
  27   27   *      Copyright (c) 1997, by Sun Microsystems, Inc.
  28   28   *      All rights reserved.
  29   29   */
  30   30  
  31      -#pragma ident   "%Z%%M% %I%     %E% SMI"
       31 +/*
       32 + * Copyright (c) 2018, Joyent, Inc.
       33 + */
  32   34  
  33   35  /*LINTLIBRARY*/
  34   36  
  35   37  #include <sys/types.h>
  36   38  #include <stdlib.h>
  37   39  #include "utility.h"
  38   40  
  39   41          /*
  40   42           *  default field
  41   43           */
↓ open down ↓ 288 lines elided ↑ open up ↑
 330  332          return (E_OK);
 331  333  }
 332  334  
 333  335          /*
 334  336           *  set_max_field
 335  337           */
 336  338  
 337  339  int
 338  340  set_max_field(FIELD *f, int max)
 339  341  {
 340      -        BOOLEAN onerow = OneRow(f);
      342 +        BOOLEAN onerow;
 341  343  
 342      -        if (!f || max && ((onerow && f->dcols > max) ||
      344 +        if (!f)
      345 +                return (E_BAD_ARGUMENT);
      346 +
      347 +        onerow = OneRow(f);
      348 +
      349 +        if (max && ((onerow && f->dcols > max) ||
 343  350              (!onerow && f->drows > max)))
 344  351                  return (E_BAD_ARGUMENT);
 345  352  
 346  353          f->maxgrow = max;
 347  354          Clr(f, GROWABLE);
 348  355  
 349  356          if (!Opt(f, O_STATIC) && ((!max || onerow && f->dcols < max) ||
 350  357              (!onerow && f->drows < max))) {
 351  358                  Set(f, GROWABLE);
 352  359          }
↓ open down ↓ 108 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX