home *** CD-ROM | disk | FTP | other *** search
- Q32515 Strnset Sets One Too Many Bytes in Some Cases
- C Compiler
- 5.10 | 5.10
- MS-DOS | OS/2
-
- Summary:
- If you attempt to set the first N+1 bytes of a string that is N
- bytes long using the strnset function, the function will incorrectly
- write one too many bytes. The function is designed to set only
- strlen(string) bytes of string if it is called with a number that is
- greater than strlen(string); however, as illustrated in the following
- example, if the strnset function is called with exactly
- strlen(string)+1 as the number of characters to set, it will write an
- extra byte:
-
-
- #include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
-
- char string1[8] = "aaaaaaa\0";
- char string2[3] = "bb\0";
-
- main()
- {
- char *dest;
- dest = strnset(string1, 'c', 8);
- printf("String1 should be 'ccccccc'. It is %s\n",string1);
- }
-
- Microsoft has confirmed this to be a problem in Version 5.10
- of the C compiler. We are researching this problem and will post new
- information as it becomes available.
-
-
-
- Keywords: buglist5.10 qfbv
- Updated 88/07/21 03:19
-