diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 900dd4455a2ba3169e6015c1ec67282eac51af40..3c4e39ff615775aff32ce47eae0ea1e2763b50ec 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -748,6 +748,10 @@ int router_load_routerlist_from_string(const char *s, int trusted)
     log(LOG_WARN, "Error parsing router file");
     return -1;
   }
+  if (*s) {
+    log(LOG_WARN, "Extraneous text at start of router file");
+    return -1;
+  }
   if (trusted) {
     int i;
     if (!trusted_dir_digests)