--- a/ifcico/nodelist.c
+++ b/ifcico/nodelist.c
@@ -208,7 +208,7 @@ faddr *addr;
 	debug(20,"getnlent: phone	%s",nodebuf.phone);
 	debug(20,"getnlent: speed	%u",nodebuf.speed);
 	debug(20,"getnlent: flags	0x%lx",nodebuf.flags);
-	for (j=0;nodebuf.uflags[j];j++)
+	for (j=0; (j < MAXUFLAGS) && (nodebuf.uflags[j]); j++)
 		debug(20,"getnlent: uflag	%s",nodebuf.uflags[j]);
 
 	return &nodebuf;
--- a/ifcico/ifinfo.c
+++ b/ifcico/ifinfo.c
@@ -102,7 +102,7 @@ int main(int argc, char *argv[])
 
       /* get user nodelist flags */
       flagbuf[0] = 0;
-      for (i = 0; nlent->uflags[i]; i++)
+      for (i = 0; (i < MAXUFLAGS) && (nlent->uflags[i]); i++)
       {
 	sprintf(flagbuf + strlen(flagbuf), "%s,", nlent->uflags[i]);
       }
