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 and
is 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

Ludovic Rousseau
On 18/08/05, Tarasov Viktor <[hidden email]> wrote:
> Hello,

Hi,

This question may be off topic. Why do you use the "," operator instead of ";"?
Maybe there is a side effect of the comma operator not described in [1].

Bye,

> --- 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;

[1] http://www.eskimo.com/~scs/cclass/int/sx4db.html

--
 Dr. Ludovic Rousseau
 For private mail use [hidden email] and not "big brother" Google
_______________________________________________
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
Ludovic Rousseau wrote:

>On 18/08/05, Tarasov Viktor <[hidden email]> wrote:
>  
>
>>Hello,
>>    
>>
>
>Hi,
>
>This question may be off topic. Why do you use the "," operator instead of ";"?
>Maybe there is a side effect of the comma operator not described in [1].
>  
>
Using of ',' operator is rather personal.
I see it like independent initialisation of the variables.
The same as:
int ii=-1, jj=1;

Best regards,
Viktor.

>Bye,
>
>  
>
>>--- 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;
>>    
>>
>
>[1] http://www.eskimo.com/~scs/cclass/int/sx4db.html
>
>  
>

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