Re: Avoiding string break...



Dear Glus,

Yesterdary, I posted the sources of an example codes [...]

It is often suggested that a problem be reduced to a minimal program before
posting it to the list. [...]

It's not necessary to look all the code, just if you need some more
data or want to run something in your computer... The question is that
in some cases (not all !!!) an std::string with encrypted values is
not sent entirely (through the Gio::Socket::send() &
Gio::Socket::receive() methods...). (hypothesis:) When the client
tries to decrypt this partial string throws an std::bad_alloc
exception instance (maybe, because it's, in fact, incomplete).

I haven't enough knowledge to find what happens inside this string, if
so. But in any cases, I need to ask you some help. Maybe, the
encryption routines are not the most appropiate. I choosen AES because
-as I know- is one of the most powerful symmetric encryption
algorithms.

You want to know why your program isn't working. You think the encryption/decryption may be losing part of your data. Or there may be a problem with zero-bytes embedded in your data. You have written a client-server app and may have a mistake in your code.

In order to solve your problem you need to decouple these. Rewrite the program (a) without encryption/decryption. Does it work now? (b) without sockets and client-server stuff. Does it work now? (c) run the program with particular data, for instance data without embedded zeros or with only zeros, or particularly short strings or empty strings. (d) think of other possibilities and leave them out.

In other words: write a simpler and smaller program and find the error in that. It you have a small and short program and can't find the error, post it on this list.

Good luck,
Mark


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]