Keep from dereferencing through a null pointer.
[unix-history] / usr / src / usr.bin / tn3270 / api / astosc.c
index 4df5756..a3ada1e 100644 (file)
@@ -5,7 +5,6 @@
 #include "../ctlr/function.h"
 
 #include "astosc.h"
 #include "../ctlr/function.h"
 
 #include "astosc.h"
-#include "state.h"
 
 struct astosc astosc[256] = {
 #include "astosc.out"
 
 struct astosc astosc[256] = {
 #include "astosc.out"
@@ -43,8 +42,8 @@ register char *string2;
 
 /*
  * This routine takes a string and returns an integer.  It may return
 
 /*
  * This routine takes a string and returns an integer.  It may return
- * STATE_NULL if there is no other integer which corresponds to the
- * string.  STATE_NULL implies an error.
+ * -1 if there is no other integer which corresponds to the
+ * string.  -1 implies an error.
  */
 
 int
  */
 
 int
@@ -54,9 +53,9 @@ register char *string;
     register struct astosc *this;
 
     for (this = astosc; this <= &astosc[highestof(astosc)]; this++) {
     register struct astosc *this;
 
     for (this = astosc; this <= &astosc[highestof(astosc)]; this++) {
-       if (ustrcmp(this->name, string) == 0) {
+       if ((this->name != 0) && (ustrcmp(this->name, string) == 0)) {
            return this-astosc;
        }
     }
            return this-astosc;
        }
     }
-    return STATE_NULL;
+    return -1;
 }
 }