index  prev  next

NULL Termination

--------------------------------------------------------------------------------------

There seems to be no definite rule in SMB as to whether a string will be null-terminated or not. The closest approximation seems to be that those strings that have an explicit length field are not null terminated, whereas other strings are. Unfortunately there are several examples where this rule is violated, usually by strings that have both and explicit length field and null termination.

Windows NT seems to be usually quite tolerent of adding null termination where it is not required. Unfortunately some other servers are much fussier (particularly NetApp).

Perhaps the trickiest thing to work out is whether explicit length fields should include the null termination or not. In most cases it doesn't matter, but there are some notable exceptions.

--------------------------------------------------------------------------------------

CIFS2001 Seattle
tridge@valinux.com