Re: padding zeros in char *
"Old Wolf" <oldwolf@inspir e.net.nz> writes:[color=blue]
> Keith Thompson wrote:[color=green]
>> I strongly suspect that AES_decrypt() requires 16-byte character
>> arrays, not strings (at least not the way C defines the term
>> "string"). Padding a character array with '\0' does make sense; in
>> fact, this may be one of the few good uses for strncpy().[/color]
>
> Unlikely, as strncpy() will stop reading the source when it
> encounters the first '\0' character. I gather from the thread
> that the source may contain multiple '\0' characters at
> various points.[/color]
Good point.
--
Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
"Old Wolf" <oldwolf@inspir e.net.nz> writes:[color=blue]
> Keith Thompson wrote:[color=green]
>> I strongly suspect that AES_decrypt() requires 16-byte character
>> arrays, not strings (at least not the way C defines the term
>> "string"). Padding a character array with '\0' does make sense; in
>> fact, this may be one of the few good uses for strncpy().[/color]
>
> Unlikely, as strncpy() will stop reading the source when it
> encounters the first '\0' character. I gather from the thread
> that the source may contain multiple '\0' characters at
> various points.[/color]
Good point.
--
Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Comment