text_combined: john viega viegasecuresoftwarecom need learn declarations work c specified testbuff array 1024 pointers characters means allocated array big enough store 1024 pointers machines thats 4 bytes per pointer indeed would give 4096 john fri nov 22 2002 102753pm 0500 ali saifullah khan wrote test done return sizes sizeof using pointers include int mainvoid char testbuff1024 int len sizeoftestbuff cout len n return 0 cdebugtestbuff 4096 output 4096 infact returning 1024 apparently using pointer multiplied value original size testbuff buffer size pointer char pointers size 4 bytesas shown output 4 bytes using int len sizeofchartestbuff cdebugtestbuff 4 sizeof returning size first entity passed size pointer whats confusing sizeof outputs value something like char testbuff macro seems multiplying sizes entities passed considering first entity pointer denoted asterisk taking value 4 multiplying size buffer testbuff 1024 produce output 4096 rather strange behaviour original message cc sent tuesday november 19 2002 259 subject bad developer libraries problem software original message john viega sent 11182002 22808 pm cdavisonnucleuscom cc secprogsecurityfocuscom subject bad developer libraries problem software strlen work trying get allocated size buffer actual size buffer youre right looking safe_strncpy code looks like author use strlen sizeof return size data type passed declared mystr char mystr1024 return original author wanted work char strings dynamically allocated passed pointer macros work mon 25 nov 2002 152838 0500 bad developer libraries problem software