"Rubens Jr." <[EMAIL PROTECTED]> writes:

> int    my_callback (....)
>     {
>     ....
>     strcpy (my_buffer, row [0]);
>     ...
>     }
>
> void    my_sql (void)
>     {
>     ...
>    strcpy (my_buffer, "SELECT .... FROM ... WHERE ....");
>    retcode = sqlite_exec (db, my_buffer, my_callback, NULL, & p_err);
>   if (retcode != SQLITE_OK)
>     showerror (p_err);
>     ....
>     }

You're asking for trouble using strcpy() with arbitrary data.  Your problem
may be that you're writing beyond the bounds of my_buffer.  Instead of

     strcpy (my_buffer, row [0]);

use

     strncpy (my_buffer, row [0], sizeof(my_buffer) - 1);
     my_buffer[sizeof(my_buffer) - 1] = '\0';

This ensures that your data is null terminated in the buffer, and that you
don't copy more data than your buffer can hold.

Some people will say NEVER use strcpy().  That's not a bad policy.  If you are
going to use it, you must be guaranteed that the amount of data being copied
will never overrun your buffer size.

This may or may not be the cause of your problem.  If you've got exactly the
same data in your database now as you did with 2.8.12, then this isn't likely
the problem, although still could be since internal variables may have moved
around and are not being scribbled upon.

Derrell

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to