When stripping the story file extension, verify that the strrchr()
found the ".". This ensures that if the file had no extension, ther
will be no SEGFAULT.
/* Now strip off the extension */
p = strrchr(f_setup.story_name, '.');
- *p = '\0'; /* extension removed */
+ if ( p != NULL )
+ {
+ *p = '\0'; /* extension removed */
+ }
/* Create nice default file names */
/* Now strip off the extension */
p = strrchr(f_setup.story_name, '.');
- *p = '\0'; /* extension removed */
+ if ( p != NULL )
+ {
+ *p = '\0'; /* extension removed */
+ }
/* Create nice default file names */