Index: trunk/src/reglookup.c
===================================================================
--- trunk/src/reglookup.c	(revision 77)
+++ trunk/src/reglookup.c	(revision 78)
@@ -216,5 +216,5 @@
     {
       tmp_err = strerror(-ret_err);
-      str_type = regfio_type_val2str(type);
+      str_type = regfi_type_val2str(type);
       *error_msg = (char*)malloc(65+strlen(str_type)+strlen(tmp_err)+1);
       if(*error_msg == NULL)
@@ -385,5 +385,5 @@
 {
   void_stack* ret_val;
-  void_stack* rev_ret = void_stack_new(1024);
+  void_stack* rev_ret = void_stack_new(REGF_MAX_DEPTH);
   const char* cur = s;
   char* next = NULL;
@@ -405,5 +405,6 @@
       memcpy(copy, cur, next-cur);
       copy[next-cur] = '\0';
-      void_stack_push(rev_ret, copy);
+      if(!void_stack_push(rev_ret, copy))
+	bailOut(2, "ERROR: Registry maximum depth exceeded.\n");
     }
     cur = next+1;
@@ -412,5 +413,6 @@
   {
     copy = strdup(cur);
-    void_stack_push(rev_ret, copy);
+    if(!void_stack_push(rev_ret, copy))
+      bailOut(2, "ERROR: Registry maximum depth exceeded.\n");
   }
 
@@ -541,5 +543,5 @@
 	      "warning returned: %s\n", prefix, quoted_name, conv_error);
 
-  str_type = regfio_type_val2str(vk->type);
+  str_type = regfi_type_val2str(vk->type);
   if(print_security)
   {
@@ -597,8 +599,8 @@
   if(print_security)
   {
-    owner = regfio_get_owner(k->sec_desc->sec_desc);
-    group = regfio_get_group(k->sec_desc->sec_desc);
-    sacl = regfio_get_sacl(k->sec_desc->sec_desc);
-    dacl = regfio_get_dacl(k->sec_desc->sec_desc);
+    owner = regfi_get_owner(k->sec_desc->sec_desc);
+    group = regfi_get_group(k->sec_desc->sec_desc);
+    sacl = regfi_get_sacl(k->sec_desc->sec_desc);
+    dacl = regfi_get_dacl(k->sec_desc->sec_desc);
     if(owner == NULL)
       owner = empty_str;
@@ -636,5 +638,5 @@
   uint32 path_len = 0;
   uint32 prefix_len = strlen(prefix);
-  int key_type = regfio_type_str2val("KEY");
+  int key_type = regfi_type_str2val("KEY");
   
   if((cur = (REGF_NK_REC*)void_stack_cur(nk_stack)) != NULL)
@@ -672,5 +674,5 @@
     while((cur = (REGF_NK_REC*)void_stack_cur(nk_stack)) != NULL)
     {
-      if((sub = regfio_fetch_subkey(f, cur)) == NULL)
+      if((sub = regfi_fetch_subkey(f, cur)) == NULL)
       {
 	sub = void_stack_pop(nk_stack);
@@ -684,5 +686,6 @@
       {
 	sub->subkey_index = 0;
-	void_stack_push(nk_stack, sub);
+	if(!void_stack_push(nk_stack, sub))
+	  bailOut(2, "ERROR: Registry maximum depth exceeded.\n");
 	path = stack2Path(nk_stack);
 	if(path != NULL)
@@ -753,10 +756,12 @@
     found_cur = false;
     while(!found_cur &&
-	  (sub = regfio_fetch_subkey(f, cur)) != NULL)
+	  (sub = regfi_fetch_subkey(f, cur)) != NULL)
     {
       if(strcasecmp(sub->keyname, cur_str) == 0)
       {
 	cur = sub;
-	void_stack_push(nk_stack, sub);
+	if(!void_stack_push(nk_stack, sub))
+	  bailOut(2, "ERROR: Registry maximum depth exceeded.\n");
+
 	found_cur = true;
       }
@@ -802,10 +807,11 @@
 	            " of specified path.\n");
 
-  while((sub = regfio_fetch_subkey(f, cur)) != NULL)
+  while((sub = regfi_fetch_subkey(f, cur)) != NULL)
   {
     if(strcasecmp(sub->keyname, cur_str) == 0)
     {
-      sub_nk_stack = void_stack_new(1024);
-      void_stack_push(sub_nk_stack, sub);
+      sub_nk_stack = void_stack_new(REGF_MAX_DEPTH);
+      if(!void_stack_push(sub_nk_stack, sub))
+	bailOut(2, "ERROR: Registry maximum depth exceeded.\n");
       prefix = stack2Path(nk_stack);
       prefix_len = strlen(prefix);
@@ -890,5 +896,5 @@
 	bailOut(1, "ERROR: '-t' option requires parameter.\n");
       }
-      if((type_filter = regfio_type_str2val(argv[argi])) < 0)
+      if((type_filter = regfi_type_str2val(argv[argi])) < 0)
       {
 	fprintf(stderr, "ERROR: Invalid type specified: %s.\n", argv[argi]);
@@ -917,5 +923,5 @@
     bailOut(2, "ERROR: Memory allocation problem.\n");
 
-  f = regfio_open(registry_file);
+  f = regfi_open(registry_file);
   if(f == NULL)
   {
@@ -924,6 +930,6 @@
   }
 
-  root = regfio_rootkey(f);
-  nk_stack = void_stack_new(1024);
+  root = regfi_rootkey(f);
+  nk_stack = void_stack_new(REGF_MAX_DEPTH);
 
   if(void_stack_push(nk_stack, root))
@@ -950,8 +956,8 @@
   }
   else
-    bailOut(2, "ERROR: Memory allocation problem.\n");
+    bailOut(2, "ERROR: Registry maximum depth exceeded.\n");
 
   void_stack_destroy_deep(nk_stack);
-  regfio_close(f);
+  regfi_close(f);
 
   return 0;
