rem: user->s[user->len] = tmp;
context: int get_user_script( db_con_t *db_hdl, str *user, str *script, char* key){	db_key_t   keys_cmp[] = {"user"};	db_key_t   keys_ret[] = { key };	db_val_t   vals[1];	db_res_t   *res = 0 ;	char       tmp;	/* it shouldn't be aproblem overwriting a \0 at the end of user name; the	 * user name is part of the sip_msg struct received -  that is allocated in	 * process private mem - no sync problems; also there is all the time some	 * extra characters after the user name - at least the EOH */	tmp = user->s[user->len];	user->s[user->len] = 0;	DBG("DEBUG:get_user_script: fetching script for user <%s>\n",user->s);	vals[0].type = DB_STRING;	vals[0].nul  = 0;	vals[0].val.string_val = user->s;	if (db_query(db_hdl, keys_cmp, 0, vals, keys_ret, 1, 1, NULL, &res) < 0) {		LOG(L_ERR,"ERROR:cpl-c:get_user_script: db_query failed\n");		goto error;	}	user->s[user->len] = tmp;	if (res->n==0) {		DBG("DEBUG:get_user_script: user <%.*s> not found in db -> probably "			"he has no script\n",user->len, user->s);		script->s = 0;		script->len = 0;	} else {		if (res->rows[0].values[0].nul) {			DBG("DEBUG:get_user_script: user <%.*s> has a NULL script\n",				user->len, user->s);			script->s = 0;			script->len = 0;		} else {			DBG("DEBUG:get_user_script: we got the script len=%d\n",				res->rows[0].values[0].val.blob_val.len);			script->len = res->rows[0].values[0].val.blob_val.len;			script->s = shm_malloc( script->len );			if (!script->s) {				LOG(L_ERR,"ERROR:cpl-c:get_user_script: no free sh_mem\n");				goto error;			}			memcpy( script->s, res->rows[0].values[0].val.blob_val.s,				script->len);		}	}	db_free_query( db_hdl, res);	return 1;error:	if (res)		db_free_query( db_hdl, res);	script->s = 0;	script->len = 0;	return -1;}