Просмотр исходного кода

- Fixed sql compile.
- Some small adjustments on how the user/password in the char server are read.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5207 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 лет назад
Родитель
Сommit
26cff5461b
3 измененных файлов с 9 добавлено и 13 удалено
  1. 4 6
      src/char/char.c
  2. 4 6
      src/char_sql/char.c
  3. 1 1
      src/map/charsave.c

+ 4 - 6
src/char/char.c

@@ -3713,10 +3713,8 @@ int check_connect_login_server(int tid, unsigned int tick, int id, int data) {
 		realloc_fifo(login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK);
                 WFIFOHEAD(login_fd, 86);
 		WFIFOW(login_fd,0) = 0x2710;
-		memset(WFIFOP(login_fd,2), 0, 24);
-		memcpy(WFIFOP(login_fd,2), userid, strlen(userid) < 24 ? strlen(userid) : 24);
-		memset(WFIFOP(login_fd,26), 0, 24);
-		memcpy(WFIFOP(login_fd,26), passwd, strlen(passwd) < 24 ? strlen(passwd) : 24);
+		memcpy(WFIFOP(login_fd,2), userid, 24);
+		memcpy(WFIFOP(login_fd,26), passwd, 24);
 		WFIFOL(login_fd,50) = 0;
 		WFIFOL(login_fd,54) = char_ip;
 		WFIFOL(login_fd,58) = char_port;
@@ -3876,9 +3874,9 @@ int char_config_read(const char *cfgName) {
 			ShowInfo("Console Silent Setting: %d\n", atoi(w2));
 			msg_silent = atoi(w2);
 		} else if (strcmpi(w1, "userid") == 0) {
-			memcpy(userid, w2, 24);
+			strncpy(userid, w2, 24);
 		} else if (strcmpi(w1, "passwd") == 0) {
-			memcpy(passwd, w2, 24);
+			strncpy(passwd, w2, 24);
 		} else if (strcmpi(w1, "server_name") == 0) {
 			memcpy(server_name, w2, sizeof(server_name));
 			server_name[sizeof(server_name) - 1] = '\0';

+ 4 - 6
src/char_sql/char.c

@@ -3674,10 +3674,8 @@ int check_connect_login_server(int tid, unsigned int tick, int id, int data) {
 		session[login_fd]->func_parse = parse_tologin;
 		realloc_fifo(login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK);
 		WFIFOW(login_fd,0) = 0x2710;
-		memset(WFIFOP(login_fd,2), 0, 24);
-		memcpy(WFIFOP(login_fd,2), userid, strlen(userid) < 24 ? strlen(userid) : 24);
-		memset(WFIFOP(login_fd,26), 0, 24);
-		memcpy(WFIFOP(login_fd,26), passwd, strlen(passwd) < 24 ? strlen(passwd) : 24);
+		memcpy(WFIFOP(login_fd,2), userid, 24);
+		memcpy(WFIFOP(login_fd,26), passwd, 24);
 		WFIFOL(login_fd,50) = 0;
 		WFIFOL(login_fd,54) = char_ip;
 		WFIFOL(login_fd,58) = char_port;
@@ -3989,9 +3987,9 @@ int char_config_read(const char *cfgName) {
 			ShowInfo("Console Silent Setting: %d\n", atoi(w2));
 			msg_silent = atoi(w2);
 		} else if (strcmpi(w1, "userid") == 0) {
-			memcpy(userid, w2, 24);
+			strncpy(userid, w2, 24);
 		} else if (strcmpi(w1, "passwd") == 0) {
-			memcpy(passwd, w2, 24);
+			strncpy(passwd, w2, 24);
 		} else if (strcmpi(w1, "server_name") == 0) {
 			memcpy(server_name, w2, sizeof(server_name));
 			server_name[sizeof(server_name) - 1] = '\0';

+ 1 - 1
src/map/charsave.c

@@ -498,7 +498,7 @@ void charsave_save_scdata(int account_id, int char_id, struct status_change* sc_
 		if (timer == NULL || timer->func != status_change_timer || DIFF_TICK(timer->tick,tick) < 0)
 			continue;
 		
-		p += (p, " ('%d','%d','%hu','%d','%d','%d','%d','%d'),", account_id, char_id,
+		p += sprintf(p, " ('%d','%d','%hu','%d','%d','%d','%d','%d'),", account_id, char_id,
 			i, DIFF_TICK(timer->tick,tick), sc_data->data[i].val1, sc_data->data[i].val2, sc_data->data[i].val3, sc_data->data[i].val4);
 		
 		count++;