summaryrefslogtreecommitdiff
path: root/lib/md5.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-04-06 16:29:36 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-04-06 16:30:09 -0700
commit022755953fc63ef70b72576e14e94324d055ef60 (patch)
tree47ea3e6fb2396a41f413badaf203d698543d68c3 /lib/md5.c
parent451a0c8b6955006f5aaa8b660a9e0b935b4fa095 (diff)
downloademacs-022755953fc63ef70b72576e14e94324d055ef60.tar.gz
Merge from gnulib
This merges some getopt fixes from Zack Weinberg, and affects only non-GNUish platforms. It incorporates: 2017-04-06 getopt-gnu: omit some duplicate code 2017-04-06 getopt-posix: use angle-bracket include 2017-04-06 getopt: annotate files with relationship to glibc 2017-04-06 getopt: split up getopt.in.h and eliminate __need_getopt 2017-04-06 getopt: better handling of ambiguous options 2017-04-06 getopt: refactor long-option handling 2017-04-06 getopt: tidy up _getopt_initialize a bit 2017-04-06 getopt: merge from glibc: repetition reduction 2017-04-06 getopt: clean up error reporting 2017-04-06 getopt: fix fencepost error in ambiguous-W-option handling 2017-04-06 getopt: clean up getopt.c and getopt1.c file headers 2017-04-06 getopt: harmonize comments with glibc 2017-04-06 getopt: remove USE_NONOPTION_FLAGS 2017-04-06 getopt: tabify, in preparation for merge with glibc 2017-04-06 md5, sha1, sha256, sha512: Add comments re correctness * build-aux/config.sub, doc/misc/texinfo.tex, lib/getopt.c: * lib/getopt.in.h, lib/getopt1.c, lib/getopt_int.h, lib/md5.c: * lib/md5.h, lib/sha1.c, lib/sha1.h, lib/sha256.c, lib/sha256.h: * lib/sha512.c, lib/sha512.h, lib/unistd.in.h, m4/getopt.m4: Copy from gnulib. * lib/getopt_cdefs.in.h, lib/getopt_core.h, lib/getopt_ext.h: * lib/getopt_pfx_core.h, lib/getopt_pfx_ext.h: New files, taken from gnulib. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
Diffstat (limited to 'lib/md5.c')
-rw-r--r--lib/md5.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/md5.c b/lib/md5.c
index e82b0514a0a..dcbba45ddff 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -246,7 +246,8 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
ctx->buflen &= 63;
- /* The regions in the following copy operation cannot overlap. */
+ /* The regions in the following copy operation cannot overlap,
+ because ctx->buflen < 64 ≤ (left_over + add) & ~63. */
memcpy (ctx->buffer,
&((char *) ctx->buffer)[(left_over + add) & ~63],
ctx->buflen);
@@ -288,6 +289,8 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
{
md5_process_block (ctx->buffer, 64, ctx);
left_over -= 64;
+ /* The regions in the following copy operation cannot overlap,
+ because left_over ≤ 64. */
memcpy (ctx->buffer, &ctx->buffer[16], left_over);
}
ctx->buflen = left_over;