mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-11-04 09:32:00 +00:00 
			
		
		
		
	rpc : avoid uninitialized memory in serialize_tensor (#13210)
Zero out the name and padding buffers.
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							f057808ffa
						
					
				
				
					commit
					8efbdadc61
				
			@@ -518,6 +518,11 @@ static rpc_tensor serialize_tensor(const ggml_tensor * tensor) {
 | 
			
		||||
    result.view_src = reinterpret_cast<uint64_t>(tensor->view_src);
 | 
			
		||||
    result.view_offs = tensor->view_offs;
 | 
			
		||||
    result.data = reinterpret_cast<uint64_t>(tensor->data);
 | 
			
		||||
 | 
			
		||||
    // Avoid sending uninitialized data over the wire
 | 
			
		||||
    memset(result.name, 0, sizeof(result.name));
 | 
			
		||||
    memset(result.padding, 0, sizeof(result.padding));
 | 
			
		||||
 | 
			
		||||
    snprintf(result.name, GGML_MAX_NAME, "%s", tensor->name);
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user