Improve handling of one kind of malformed CDCC save file, where the pack

description line doesn't contain a space.  Found by Coverity.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@244 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Kevin Easton
2013-06-20 01:45:29 +00:00
parent 882c3150e2
commit c51810738e
2 changed files with 5 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
[Changes 1.2c01] [Changes 1.2c01]
* Improve robustness of CDCC save file loading. (caf)
* Fix open file leak in /LASTLOG found by Coverity. (caf) * Fix open file leak in /LASTLOG found by Coverity. (caf)
* Fix file descriptor leak on SOCKS4 connection failure found by * Fix file descriptor leak on SOCKS4 connection failure found by

View File

@@ -1182,11 +1182,11 @@ static int l_load(char *args, char *rest)
chop(buffer, 1); chop(buffer, 1);
temp = strrchr(buffer, ' '); temp = strrchr(buffer, ' ');
*temp = '\0'; if (temp)
temp++; *temp++ = '\0';
malloc_strcpy(&ptr->desc, buffer); malloc_strcpy(&ptr->desc, buffer);
if (*temp && !isdigit((unsigned char)*temp)) if (!temp || !isdigit((unsigned char)*temp))
{ {
put_it("%s: not a cdcc pack aborting", cparse(get_string_var(CDCC_PROMPT_VAR))); put_it("%s: not a cdcc pack aborting", cparse(get_string_var(CDCC_PROMPT_VAR)));
new_free(&ptr->file); new_free(&ptr->file);