Print this page
10118 libeti() NULL check after deref

@@ -26,11 +26,13 @@
 /*
  *      Copyright (c) 1997, by Sun Microsystems, Inc.
  *      All rights reserved.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
+/*
+ * Copyright (c) 2018, Joyent, Inc.
+ */
 
 /*LINTLIBRARY*/
 
 #include <sys/types.h>
 #include <stdlib.h>

@@ -335,13 +337,18 @@
          */
 
 int
 set_max_field(FIELD *f, int max)
 {
-        BOOLEAN onerow = OneRow(f);
+        BOOLEAN onerow;
 
-        if (!f || max && ((onerow && f->dcols > max) ||
+        if (!f)
+                return (E_BAD_ARGUMENT);
+
+        onerow = OneRow(f);
+
+        if (max && ((onerow && f->dcols > max) ||
             (!onerow && f->drows > max)))
                 return (E_BAD_ARGUMENT);
 
         f->maxgrow = max;
         Clr(f, GROWABLE);