From 89dc72bc3a48f1e94fd73e71790d3e810b9c8fc2 Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Thu, 6 May 2004 22:59:08 +0000 Subject: [PATCH] Add support for DOS line-endings to md5sum. --- ChangeLog | 4 ++++ debian/changelog | 1 + utils/md5sum.c | 9 ++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e103ef9e..b6c03379 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu May 6 23:57:52 BST 2004 Andrew Shugg + + * utils/md5sum.c: Add support for DOS line-endings (\r\n). + Thu May 6 23:52:28 BST 2004 Daniel Kobras * archtable: Add ia64-unknown-linux-gnu. diff --git a/debian/changelog b/debian/changelog index 6e16abcb..c5f5179c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,7 @@ dpkg (1.10.22) unstable; urgency=low casing. Closes: #154422. * Fix segfault when "gcc -dumpmachine" returns a non-matching triplet. Closes: #211850. + * Add support for DOS line-endings to md5sum. Closes: #246103. * Correct 'n' and 'p' key descriptions in dselect help message. Closes: #120562. * Stop hardcoding the list of manual page languages in debian/rules, diff --git a/utils/md5sum.c b/utils/md5sum.c index f84634ca..98c39c61 100644 --- a/utils/md5sum.c +++ b/utils/md5sum.c @@ -257,7 +257,14 @@ get_md5_line(FILE *fp, unsigned char *digest, char *file) /* Strip the trailing newline, if present */ if (p[i-1] == '\n') - p[i-1] = '\0'; + if (p[i-2] == '\r') + if (i < 3) + return 0; + + p[i-2] = '\0'; + else + p[i-1] = '\0'; + } strcpy(file, p); return rc; -- 2.39.5