Browse Source

- avoid potential read overflow on non NULL terminated string
port from opensips (#4980), credits to Dan Pascu


git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5355 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt 16 years ago
parent
commit
1d7bba5426
1 changed files with 1 additions and 0 deletions
  1. 1 0
      lib/srdb1/db.c

+ 1 - 0
lib/srdb1/db.c

@@ -170,6 +170,7 @@ int db_bind_mod(const str* mod, db_func_t* mydbf)
 	char * prefix = "db_";
 	char * prefix = "db_";
 	memcpy(name, prefix, 3);
 	memcpy(name, prefix, 3);
 	memcpy(name+3, mod->s, mod->len);
 	memcpy(name+3, mod->s, mod->len);
+	name[mod->len+3] = 0;
 
 
 	/* for safety we initialize mydbf with 0 (this will cause
 	/* for safety we initialize mydbf with 0 (this will cause
 	 *  a segfault immediately if someone tries to call a function
 	 *  a segfault immediately if someone tries to call a function