Browse Source

htable: Fix buffer overrun in htable_rpc_list

- Fix for using wrong len variable in htable_rpc_list if
  ht->dbtable.len is greater than 127, causing an out of
  bounds write.
Chris Double 10 years ago
parent
commit
1c164473c6
1 changed files with 1 additions and 1 deletions
  1. 1 1
      modules/htable/htable.c

+ 1 - 1
modules/htable/htable.c

@@ -1044,7 +1044,7 @@ static void  htable_rpc_list(rpc_t* rpc, void* c)
 		if (ht->dbtable.len > 0) {
 			len = ht->dbtable.len > 127 ? 127 : ht->dbtable.len;
 			memcpy(dbname, ht->dbtable.s, len);
-			dbname[ht->dbtable.len] = '\0';
+			dbname[len] = '\0';
 		} else {
 			dbname[0] = '\0';
 		}