mirror of
				https://github.com/Tha14/toxic.git
				synced 2025-11-04 04:26:52 +01:00 
			
		
		
		
	Fix nodes parsing bug
This commit is contained in:
		
							
								
								
									
										10
									
								
								src/toxic.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/toxic.c
									
									
									
									
									
								
							@@ -316,16 +316,14 @@ static int load_nodelist(const char *filename)
 | 
				
			|||||||
            toxNodes.ports[toxNodes.lines] = atoi(port);
 | 
					            toxNodes.ports[toxNodes.lines] = atoi(port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* remove possible trailing newline from key string */
 | 
					            /* remove possible trailing newline from key string */
 | 
				
			||||||
            char key_binary[TOX_PUBLIC_KEY_SIZE * 2 + 1];
 | 
					            char real_ascii_key[TOX_PUBLIC_KEY_SIZE * 2 + 1];
 | 
				
			||||||
            memcpy(key_binary, key_ascii, TOX_PUBLIC_KEY_SIZE * 2);
 | 
					            memcpy(real_ascii_key, key_ascii, TOX_PUBLIC_KEY_SIZE * 2);
 | 
				
			||||||
            key_len = TOX_PUBLIC_KEY_SIZE * 2;
 | 
					            key_len = TOX_PUBLIC_KEY_SIZE * 2;
 | 
				
			||||||
            key_binary[key_len] = '\0';
 | 
					            real_ascii_key[key_len] = '\0';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (hex_string_to_bin(key_ascii, key_len, key_binary, TOX_PUBLIC_KEY_SIZE) == -1)
 | 
					            if (hex_string_to_bin(real_ascii_key, key_len, toxNodes.keys[toxNodes.lines], TOX_PUBLIC_KEY_SIZE) == -1)
 | 
				
			||||||
                continue;
 | 
					                continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            memcpy(toxNodes.keys[toxNodes.lines], key_binary, TOX_PUBLIC_KEY_SIZE);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            toxNodes.lines++;
 | 
					            toxNodes.lines++;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user