~ubuntu-branches/ubuntu/wily/clamav/wily-proposed

« back to all changes in this revision

Viewing changes to libclamav/crypto.c

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman, Sebastian Andrzej Siewior, Andreas Cadhalpun, Scott Kitterman, Javier Fernández-Sanguino
  • Date: 2015-01-28 00:25:13 UTC
  • mfrom: (0.48.14 sid)
  • Revision ID: package-import@ubuntu.com-20150128002513-lil2oi74cooy4lzr
Tags: 0.98.6+dfsg-1
[ Sebastian Andrzej Siewior ]
* update "fix-ssize_t-size_t-off_t-printf-modifier", include of misc.h was
  missing but was pulled in via the systemd patch.
* Don't leak return codes from libmspack to clamav API. (Closes: #774686).

[ Andreas Cadhalpun ]
* Add patch to avoid emitting incremental progress messages when not
  outputting to a terminal. (Closes: #767350)
* Update lintian-overrides for unused-file-paragraph-in-dep5-copyright.
* clamav-base.postinst: always chown /var/log/clamav and /var/lib/clamav
  to clamav:clamav, not only on fresh installations. (Closes: #775400)
* Adapt the clamav-daemon and clamav-freshclam logrotate scripts,
  so that they correctly work under systemd.
* Move the PidFile variable from the clamd/freshclam configuration files
  to the init scripts. This makes the init scripts more robust against
  misconfiguration and avoids error messages with systemd. (Closes: #767353)
* debian/copyright: drop files from Files-Excluded only present in github
  tarballs
* Drop Workaround-a-bug-in-libc-on-Hurd.patch, because hurd got fixed.
  (see #752237)
* debian/rules: Remove useless --with-system-tommath --without-included-ltdl
  configure options.

[ Scott Kitterman ]
* Stop stripping llvm when repacking the tarball as the system llvm on some
  releases is too old to use
* New upstream bugfix release
  - Library shared object revisions.
  - Includes a patch from Sebastian Andrzej Siewior making ClamAV pid files
    compatible with systemd.
  - Fix a heap out of bounds condition with crafted Yoda's crypter files.
    This issue was discovered by Felix Groebert of the Google Security Team.
  - Fix a heap out of bounds condition with crafted mew packer files. This
    issue was discovered by Felix Groebert of the Google Security Team.
  - Fix a heap out of bounds condition with crafted upx packer files. This
    issue was discovered by Kevin Szkudlapski of Quarkslab.
  - Fix a heap out of bounds condition with crafted upack packer files. This
    issue was discovered by Sebastian Andrzej Siewior. CVE-2014-9328.
  - Compensate a crash due to incorrect compiler optimization when handling
    crafted petite packer files. This issue was discovered by Sebastian
    Andrzej Siewior.
* Update lintian override for embedded zlib to match new so version

[ Javier Fernández-Sanguino ]
* Updated Spanish Debconf template translation (Closes: #773563)

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
#include "others.h"
61
61
#include "libclamav/conv.h"
62
62
#include "libclamav/str.h"
 
63
#include "iowrap.h"
63
64
 
64
65
#if defined(_WIN32)
65
66
char * strptime(const char *buf, const char *fmt, struct tm *tm);
66
67
#endif
67
68
 
 
69
#if defined(_WIN32)
 
70
#define EXCEPTION_PREAMBLE __try {
 
71
#define EXCEPTION_POSTAMBLE } __except (filter_memcpy(GetExceptionCode(), GetExceptionInformation())) { \
 
72
    winres=1; \
 
73
}
 
74
#else
 
75
#define EXCEPTION_PREAMBLE
 
76
#define EXCEPTION_POSTAMBLE
 
77
#endif
 
78
 
68
79
#if !defined(MIN)
69
80
    #define MIN(x,y) ((x)<(y)?(x):(y))
70
81
#endif
132
143
    const EVP_MD *md;
133
144
    unsigned int i;
134
145
    size_t cur;
 
146
    int winres=0;
135
147
 
136
148
    md = EVP_get_digestbyname(alg);
137
149
    if (!(md))
170
182
    cur=0;
171
183
    while (cur < len) {
172
184
        size_t todo = MIN((unsigned long)EVP_MD_block_size(md), (unsigned long)(len-cur));
 
185
 
 
186
        EXCEPTION_PREAMBLE
173
187
        if (!EVP_DigestUpdate(ctx, (void *)(((unsigned char *)buf)+cur), todo)) {
174
188
            if (!(obuf))
175
189
                free(ret);
180
194
            EVP_MD_CTX_destroy(ctx);
181
195
            return NULL;
182
196
        }
 
197
        EXCEPTION_POSTAMBLE
 
198
 
 
199
        if (winres) {
 
200
            if (!(obuf))
 
201
                free(ret);
 
202
 
 
203
            if ((olen))
 
204
                *olen = 0;
 
205
 
 
206
            EVP_MD_CTX_destroy(ctx);
 
207
            return NULL;
 
208
        }
183
209
 
184
210
        cur += todo;
185
211
    }
240
266
    int mdsz;
241
267
    unsigned int hashlen;
242
268
    STATBUF sb;
 
269
    int winres=0;
243
270
 
244
271
        unsigned int blocksize;
245
272
 
277
304
#else
278
305
    while ((nread = read(fd, buf, blocksize)) > 0) {
279
306
#endif
 
307
        EXCEPTION_PREAMBLE
280
308
        if (!EVP_DigestUpdate(ctx, buf, nread)) {
281
309
            free(buf);
282
310
            free(hash);
283
311
 
284
312
            return NULL;
285
313
        }
 
314
        EXCEPTION_POSTAMBLE
 
315
 
 
316
        if (winres) {
 
317
            free(buf);
 
318
            free(hash);
 
319
 
 
320
            return NULL;
 
321
        }
286
322
    }
287
323
 
288
324
    if (!EVP_DigestFinal_ex(ctx, hash, &hashlen)) {
1123
1159
 
1124
1160
int cl_update_hash(void *ctx, void *data, size_t sz)
1125
1161
{
 
1162
    int winres=0;
 
1163
 
1126
1164
    if (!(ctx) || !(data))
1127
1165
        return -1;
1128
1166
 
 
1167
    EXCEPTION_PREAMBLE
1129
1168
    if (!EVP_DigestUpdate((EVP_MD_CTX *)ctx, data, sz))
1130
1169
        return -1;
 
1170
    EXCEPTION_POSTAMBLE
 
1171
 
 
1172
    if (winres)
 
1173
        return -1;
1131
1174
 
1132
1175
    return 0;
1133
1176
}