Comment 25 for bug 617885

Luca Bruno (lucab) wrote :

> For example the following line of code to detect LUKS encryption:
>
> if ( Glib::ustring( magic1 ) == "LUKS\xBA\xBE" )

Yes. If I'm reading comment #12 correctly, Seth is saying that ustring constructor is often unhappy when fed with raw-from-disk data (invalid utf-8?). In particular, he wrote:

> > Also, this calls to review a lot more ustring operations on raw input
> > buffers, because things could blow up in more places where it is
> > being used on unknown data (raw input buffers).

Seth, care to comment?
My opinion is that it may be safer to do a plain memcmp, but I suspect the issue Seth was experiencing was just due to buf_btrfs being not NUL-terminated.