gzip: add "--keep" option to retain (don't delete) input files
[debian/gzip] / deflate.c
index 6c195522c963305c137af6bd768e178d334cd057..f0f23940ac9d0c891877105ebc803d508483987d 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -1,6 +1,6 @@
 /* deflate.c -- compress data using the deflation algorithm
 
-   Copyright (C) 1999, 2006, 2009-2012 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2006, 2009-2013 Free Software Foundation, Inc.
    Copyright (C) 1992-1993 Jean-loup Gailly
 
    This program is free software; you can redistribute it and/or modify
@@ -571,6 +571,8 @@ local void fill_window()
         n = read_buf((char*)window+strstart+lookahead, more);
         if (n == 0 || n == (unsigned)EOF) {
             eofile = 1;
+            /* Don't let garbage pollute the dictionary.  */
+            memzero (window + strstart + lookahead, MIN_MATCH - 1);
         } else {
             lookahead += n;
         }