News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

lstr* Commands

Started by asmftw, September 19, 2007, 10:56:30 PM

Previous topic - Next topic

asmftw

Do lstrcpy and lstrcat append 0 to the end of the target string? I've had many issues with overflowing buffers and I think this may be what was causing it all this time.

jdoe

Quote from: asmftw on September 19, 2007, 10:56:30 PM
Do lstrcpy and lstrcat append 0 to the end of the target string? I've had many issues with overflowing buffers and I think this may be what was causing it all this time.

Yes and No. The null char terminator is coming from the strings that you pass as parameters. If an error occur, it's because one of the source or destination strings is not null terminated.


asmftw

So you mean if I attach a string that isn't null terminated, the destination will note become null terminated?

jdoe

Quote from: asmftw on September 20, 2007, 12:29:45 AM
So you mean if I attach a string that isn't null terminated, the destination will note become null terminated?

A string that don't need to be null terminated is rare like pope sh*t   :P

When a function copy one string to another, the null char tells to the function when to stop the copy and without terminator, the function continue to copy until a fault occur.


asmftw


Vortex

The lstr* functions are OK for general purpose programming but you should have a look at the string functions supplied with the Masm32 package. They are optimized to run faster than lstr* functions.