blob: cb7c47b3f5298e7aaaa63d825976795ae372e580 [file] [log] [blame]
Richard Marian Thomaiyar14fddef2018-07-13 23:55:56 +05301fix the bug:
2g_canon_name.c:125:5: warning: passing argument 2 of '__gss_copy_namebuf' from incompatible pointer type [enabled by default]
3
4the 2nd argument of __gss_copy_namebuf should be address of *gss_buffer_t, \
5but a *gss_buffer_t is assigned.
6
7what __gss_copy_namebuf does is to alloc memory for a gss_buffer_desc and \
8copy from src and return its address.
9
10if following code failed, gss_release_name will free \
11union_canon_name->external_name.value if it is not NULL.
12
13OM_uint32 __gss_copy_namebuf(src, dest)
14 gss_buffer_t src;
15 gss_buffer_t *dest;
16
17typedef struct gss_union_name_t {
18 gss_mechanism gss_mech;
19 gss_OID name_type;
20 gss_buffer_desc external_name;
21 /*
22 * These last two fields are only filled in for mechanism
23 * names.
24 */
25 gss_OID mech_type;
26 gss_name_t mech_name;
27} gss_union_name_desc, *gss_union_name_t;
28
29typedef struct gss_buffer_desc_struct {
30 size_t length;
31 void FAR *value;
32} gss_buffer_desc, FAR *gss_buffer_t;
33
34Upstream-Status: Pending
35Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
36
37--- a/src/g_canon_name.c
38+++ b/src/g_canon_name.c
39@@ -121,11 +121,17 @@ gss_canonicalize_name (OM_uint32 *minor_
40
41 union_canon_name->mech_name = mech_name;
42
43- status = __gss_copy_namebuf(&union_input_name->external_name,
44- &union_canon_name->external_name);
45- if (status != GSS_S_COMPLETE)
46- goto failure;
47+ union_canon_name->external_name.value = (void*) malloc(
48+ union_input_name->external_name.length + 1);
49+ if (!union_canon_name->external_name.value)
50+ goto failure;
51
52+ memcpy(union_canon_name->external_name.value,
53+ union_input_name->external_name.value,
54+ union_input_name->external_name.length);
55+ union_canon_name->external_name.length =
56+ union_input_name->external_name.length;
57+
58 if (union_input_name->name_type != GSS_C_NO_OID) {
59 status = generic_gss_copy_oid(minor_status,
60 union_input_name->name_type,