fixed potential invalid memory read in openpgpsdk

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8486 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
electron128 2015-06-16 13:23:06 +00:00
parent 8fc3917c4b
commit 5e5dd3d12d

View File

@ -1211,6 +1211,12 @@ ops_write_literal_data_from_file(const char *filename,
n=read(fd,buf,1024); n=read(fd,buf,1024);
if (!n) if (!n)
break; break;
if (n == -1)
{
close(fd);
ops_memory_free(mem);
return ops_false;
}
ops_memory_add(mem, &buf[0], n); ops_memory_add(mem, &buf[0], n);
} }
close(fd); close(fd);