Browse code

alias_db: set ending zero in a single place

Daniel-Constantin Mierla authored on 26/10/2020 06:42:10
Showing 1 changed files
... ...
@@ -163,19 +163,18 @@ static int alias_db_query(struct sip_msg* _msg, str table,
163 163
 					(char*)RES_ROWS(db_res)[i].values[1].val.str_val.s,
164 164
 					RES_ROWS(db_res)[i].values[1].val.str_val.len);
165 165
 				user_s.len += RES_ROWS(db_res)[i].values[1].val.str_val.len;
166
-				useruri_buf[user_s.len] = '\0';
167 166
 			break;
168 167
 			case DB1_BLOB:
169 168
 				strncpy(user_s.s, 
170 169
 					(char*)RES_ROWS(db_res)[i].values[1].val.blob_val.s,
171 170
 					RES_ROWS(db_res)[i].values[1].val.blob_val.len);
172 171
 				user_s.len += RES_ROWS(db_res)[i].values[1].val.blob_val.len;
173
-				useruri_buf[user_s.len] = '\0';
174 172
 			break;
175 173
 			default:
176 174
 				LM_ERR("unknown type of DB user column\n");
177 175
 				goto err_server;
178 176
 		}
177
+		useruri_buf[user_s.len] = '\0';
179 178
 		user_s.s = useruri_buf;
180 179
 		/* set the URI */
181 180
 		LM_DBG("new URI [%d] is [%.*s]\n", i, user_s.len ,user_s.s );