From 3fb939657f350774f6b4216c9d416eff1745a1b3 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 29 May 2019 12:36:24 -0400 Subject: [PATCH 1/1] LP1830642 Remove variable args from md5sum() Remove support for passing variable args to the md5sum() function, since no code currently uses this, and it causes problems processing strings with '%' characters. Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- include/opensrf/utils.h | 2 +- src/libopensrf/utils.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/opensrf/utils.h b/include/opensrf/utils.h index 34e0ba6..f9e156c 100644 --- a/include/opensrf/utils.h +++ b/include/opensrf/utils.h @@ -367,7 +367,7 @@ int stringisnum(const char* s); Calculates the md5 of the text provided. The returned string must be freed by the caller. */ -char* md5sum( const char* text, ... ); +char* md5sum( const char* text ); /* diff --git a/src/libopensrf/utils.c b/src/libopensrf/utils.c index 2698f1d..6b1d9aa 100644 --- a/src/libopensrf/utils.c +++ b/src/libopensrf/utils.c @@ -732,18 +732,16 @@ int stringisnum(const char* s) { This function is a wrapper for some public domain routines written by David Madore, Ron Rivest, and Colin Plumb. */ -char* md5sum( const char* text, ... ) { +char* md5sum( const char* text ) { struct md5_ctx ctx; unsigned char digest[16]; MD5_start (&ctx); - VA_LIST_TO_STRING(text); - int i; - for ( i=0 ; i != strlen(VA_BUF) ; i++ ) - MD5_feed (&ctx, VA_BUF[i]); + for ( i=0 ; i != strlen(text) ; i++ ) + MD5_feed (&ctx, text[i]); MD5_stop (&ctx, digest); -- 2.43.2