Probably bug in trunk version

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Probably bug in trunk version

Tarasov Viktor
Hello,

this bug concerns the trunk version.
It's manifesting when sc_file_free() is applied to some file and the
file duplicate, obtained with the sc_file_dup().

In the sc_file_dup(),
the 'sec_attr', 'prop_attr' and 'type_attr' of the
new file are simply copied from the source file, not allocated.

Kind wishes,
Viktor.






--- opensc.trunk.orig/src/libopensc/sc.c 2005-08-11 14:28:40.000000000 +0200
+++ opensc.trunk/src/libopensc/sc.c 2005-08-18 17:03:32.000000000 +0200
@@ -389,6 +389,15 @@
  if (e != NULL)
  sc_file_add_acl_entry(newf, op, e->method, e->key_ref);
  }
+
+ newf->sec_attr = NULL,  newf->sec_attr_len = 0;
+ sc_file_set_sec_attr(newf, src->sec_attr, src->sec_attr_len);
+
+ newf->prop_attr = NULL,  newf->prop_attr_len = 0;
+ sc_file_set_prop_attr(newf, src->prop_attr, src->prop_attr_len);
+
+ newf->type_attr = NULL,  newf->type_attr_len = 0;
+ sc_file_set_type_attr(newf, src->type_attr, src->type_attr_len);
 }
 
 int sc_file_set_sec_attr(sc_file_t *file, const u8 *sec_attr,


_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: Probably bug in trunk version

Nils Larsch
Tarasov Viktor wrote:
> Hello,
>
> this bug concerns the trunk version.
> It's manifesting when sc_file_free() is applied to some file and the
> file duplicate, obtained with the sc_file_dup().
>
> In the sc_file_dup(),
> the 'sec_attr', 'prop_attr' and 'type_attr' of the
> new file are simply copied from the source file, not allocated.

I've applied a slightly modified patch, please test.

Thanks,
Nils
_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: Probably bug in trunk version

Tarasov Viktor
Nils Larsch wrote:

> Tarasov Viktor wrote:
>
>> Hello,
>>
>> this bug concerns the trunk version.
>> It's manifesting when sc_file_free() is applied to some file and the
>> file duplicate, obtained with the sc_file_dup().
>>
>> In the sc_file_dup(),
>> the 'sec_attr', 'prop_attr' and 'type_attr' of the
>> new file are simply copied from the source file, not allocated.
>
>
> I've applied a slightly modified patch, please test.

It's OK.
Viktor.

>
> Thanks,
> Nils
>
>

_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel