[3104] in Kerberos-V5-bugs
krb5-clients/745: ksu/main.c disregards const char * return from krb5_cc_default_name
daemon@ATHENA.MIT.EDU (Ezra Peisach)
Thu Sep 2 10:13:08 1999
Resent-From: gnats@rt-11.MIT.EDU (GNATS Management)
Resent-To: krb5-unassigned@RT-11.MIT.EDU
Resent-Reply-To: krb5-bugs@MIT.EDU, epeisach@engrailed.mit.edu
Message-Id: <199909021401.KAA60158@engrailed.mit.edu>
Date: Thu, 2 Sep 1999 10:01:18 -0400 (EDT)
From: epeisach@engrailed.mit.edu (Ezra Peisach)
Reply-To: epeisach@engrailed.mit.edu
To: krb5-bugs@MIT.EDU
>Number: 745
>Category: krb5-clients
>Synopsis: Compiler warning when compiling ksu in main.c
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: krb5-unassigned
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Thu Sep 02 10:13:01 EDT 1999
>Last-Modified:
>Originator: Ezra Peisach
>Organization:
MIT
>Release: krb5-1.1-beta1
>Environment:
System: IRIX64 engrailed 6.5 05190004 IP30
>Description:
"../../../src/clients/ksu/main.c", line 378: warning(1515): a value of type
"const char *" cannot be assigned to an entity of type "char *"
cc_source_tag = krb5_cc_default_name(ksu_context);
krb5_cc_default_name() returns a const char *.
While the code path does not appear to muck with the contents of
krb5_cc_default_name() (hence the low severity of the bug), I feel it
only proper to fix.
>How-To-Repeat:
Compile
>Fix:
A proper fix is to fix all char * to const char * as needed, but
one gets into trouble with cc_target_tag being used as an
argument to sprintf. I have resorted to the memory leaking
simple fix of:
*** main.c 1999/09/02 13:35:26 1.1
--- main.c 1999/09/02 13:56:02
***************
*** 375,381 ****
/***********************************/
if (cc_source_tag == NULL){
! cc_source_tag = krb5_cc_default_name(ksu_context);
cc_source_tag_tmp = strchr(cc_source_tag, ':') + 1;
if (cc_source_tag_tmp == (char *) 1)
cc_source_tag_tmp = cc_source_tag;
--- 375,381 ----
/***********************************/
if (cc_source_tag == NULL){
! cc_source_tag = strdup(krb5_cc_default_name(ksu_context));
cc_source_tag_tmp = strchr(cc_source_tag, ':') + 1;
if (cc_source_tag_tmp == (char *) 1)
cc_source_tag_tmp = cc_source_tag;
>Audit-Trail:
>Unformatted: