From e3b3470fc9a847277e43bed9e87e6b16528a82f2 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Sat, 4 May 1996 02:11:35 +0000 Subject: [PATCH] cygnus merge: sscanf workaround; logs for sam tests git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7897 dc483132-0cff-0310-8789-dd5450dbe970 --- src/tests/asn.1/ChangeLog | 18 ++++++++++++++++++ src/tests/asn.1/utility.c | 12 +++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/tests/asn.1/ChangeLog b/src/tests/asn.1/ChangeLog index e47a2b2c0..ddce14a2c 100644 --- a/src/tests/asn.1/ChangeLog +++ b/src/tests/asn.1/ChangeLog @@ -1,3 +1,21 @@ +Tue Apr 2 20:57:12 1996 Chris Provenzano + + * utility.c (krb5_data_hex_parse()) : Do a strdup() of string before + sending it off to sscanf(), because some systems sscanf can't + handle non writeable strings. + +Fri Mar 29 03:00:34 1996 Mark Eichin + + * krb5_decode_test.c (main): add tests for krb5_sam_challenge and + krb5_sam_response. + * krb5_encode_test.c (main): likewise. + * ktest.c (ktest_make_sample_sam_challenge, + ktest_make_sample_sam_response): new functions, supporting tests + of new types. + * ktest_equal.c (ktest_equal_sam_challenge, + ktest_equal_sam_response): new comparators. + * reference_encode.out, trval_reference.out: add data for test cases. + Mon Mar 18 21:49:39 1996 Ezra Peisach * configure.in: Add KRB5_RUN_FLAGS diff --git a/src/tests/asn.1/utility.c b/src/tests/asn.1/utility.c index 324c98976..739d63913 100644 --- a/src/tests/asn.1/utility.c +++ b/src/tests/asn.1/utility.c @@ -65,12 +65,18 @@ krb5_error_code krb5_data_hex_parse(d, s) const char * s; { int i, digit; + char *copy; char *pos; - d->data = (char*)calloc((strlen(s)+1)/3,sizeof(char)); + /* + * Do a strdup() and use that, because some systems can't handle non + * writeable strings being passed to sscanf() --proven. + */ + copy = strdup(s); + d->data = (char*)calloc((strlen(copy)+1)/3,sizeof(char)); if(d->data == NULL) return ENOMEM; - d->length = (strlen(s)+1)/3; - for(i=0,pos=(char*)s; ilength; i++,pos+=3){ + d->length = (strlen(copy)+1)/3; + for(i=0,pos=(char*)copy; ilength; i++,pos+=3){ if(!sscanf(pos,"%x",&digit)) { #ifdef KRB5_USE_ISODE return EINVAL; -- 2.26.2