On Tue, Nov 03, 2009 at 12:29:46PM -0500, N N wrote:

> #include <openssl/hmac.h>
> #include <stdio.h>
> 
> int main(int argc, char** argv) {
>   unsigned char foo[10] = "boo";
>   unsigned char* res = malloc(20);
>   unsigned char* res2 = res;
>   res = SHA1(foo, 3, 0);
>   //res = SHA1(foo, 3, res);
> 
>   int i;
>   for(i = 0; i < 20; i++)
>     printf("%x ", res[i]);
>   printf("\n");
>   free(res2);
> }

Try to compile it. Read and understand the gcc warnings, fix the bugs,
and the segfault is gone.

Gabor

-- 
     ---------------------------------------------------------
     MTA SZTAKI Computer and Automation Research Institute
                Hungarian Academy of Sciences
     ---------------------------------------------------------


-- 
To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to