much annoyance over string limit lengths

Luke Kenneth Casson Leighton lkcl at regent.push.net
Sat Apr 11 18:06:31 GMT 1998


*dur*.  i wondered why i was having problems with UNISTR2.  it just so
happens that the dialogs in NT that produce the data that is available
behind NetShareEnum limit the share comment length to 256 characters.

i limited the UNISTR2 length _also_ to 256 uint16 chars.  this resulted in
strings being read in short by one character.  so i've increased the
string length to 384.

this is not a good solution.  what really needs to happen is that strings
should be dynamically allocated.  as, in fact, should everything else. 
ok, there is a way round that.  you dynamically allocate a single block of
memory, and then copy the data structures into that.  any pointers to
structures means that the structure is put into the next free bit of
memory.

then when you are done, you need only free the block of memory, not
several blocks.  reason for doing this: i don't want to have to "free" a
series of structures once you're done with them.

rambling-luke




More information about the samba-technical mailing list