mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 02:03:20 -04:00 
			
		
		
		
	[plugin/cache] create a copy of a response to ensure original data is never modified (#7357)
Signed-off-by: Oleg Guba <oleg.guba@gmail.com>
This commit is contained in:
		
							
								
								
									
										1
									
								
								plugin/cache/cache.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								plugin/cache/cache.go
									
									
									
									
										vendored
									
									
								
							| @@ -182,6 +182,7 @@ func (w *ResponseWriter) RemoteAddr() net.Addr { | ||||
|  | ||||
| // WriteMsg implements the dns.ResponseWriter interface. | ||||
| func (w *ResponseWriter) WriteMsg(res *dns.Msg) error { | ||||
| 	res = res.Copy() | ||||
| 	mt, _ := response.Typify(res, w.now().UTC()) | ||||
|  | ||||
| 	// key returns empty string for anything we don't want to cache. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user