Index: modules/forum/forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v
retrieving revision 1.375.2.6
diff -u -p -r1.375.2.6 forum.module
--- modules/forum/forum.module	8 Aug 2007 06:27:22 -0000	1.375.2.6
+++ modules/forum/forum.module	10 Oct 2007 10:25:46 -0000
@@ -847,6 +847,15 @@ function forum_page($tid = 0) {
   $forum_per_page = variable_get('forum_per_page', 25);
   $sortby = variable_get('forum_order', 1);
 
+  if ($tid !== 0) {
+    $term = taxonomy_get_term($tid);
+    if (empty($term) || $term->vid != variable_get('forum_nav_vocabulary', '')) {
+      // this term doesn't exist or its not in the forum vocabulary
+      // generate the proper HTTP not found response
+      return drupal_not_found();
+    }
+  }
+
   $forums = forum_get_forums($tid);
   $parents = taxonomy_get_parents_all($tid);
   if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
