Index: forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v
retrieving revision 1.375.2.9
diff -u -r1.375.2.9 forum.module
--- forum.module	1 Jul 2009 20:52:11 -0000	1.375.2.9
+++ forum.module	15 Oct 2009 11:43:47 -0000
@@ -837,6 +837,13 @@
     return MENU_NOT_FOUND;
   }
   $tid = (int)$tid;
+  
+  $term = taxonomy_get_term($tid);
+  $forum_nav_vocabulary = variable_get('forum_nav_vocabulary', '');
+  // Check if this is a valid term from forum nav vocabulary.
+  if (!empty($tid) and $term->vid != $forum_nav_vocabulary) {
+    return drupal_not_found();
+  }  
 
   drupal_add_css(drupal_get_path('module', 'forum') .'/forum.css');
   $forum_per_page = variable_get('forum_per_page', 25);

