зеркало из https://github.com/nextcloud/desktop.git
Fix a stack smash.
This commit is contained in:
Родитель
de0a689b12
Коммит
6af37010cd
|
@ -35,16 +35,18 @@
|
||||||
#define CSYNC_LOG_CATEGORY_NAME "csync.journal"
|
#define CSYNC_LOG_CATEGORY_NAME "csync.journal"
|
||||||
#include "csync_log.h"
|
#include "csync_log.h"
|
||||||
|
|
||||||
|
#define BUF_SIZE 16
|
||||||
|
|
||||||
static int csync_journal_check(const char *journal) {
|
static int csync_journal_check(const char *journal) {
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
char buf[16] = {0};
|
char buf[BUF_SIZE] = {0};
|
||||||
sqlite3 *db = NULL;
|
sqlite3 *db = NULL;
|
||||||
|
|
||||||
/* check db version */
|
/* check db version */
|
||||||
fd = open(journal, O_RDONLY);
|
fd = open(journal, O_RDONLY);
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
if (read(fd, (void *) buf, (size_t) 16) >= 0) {
|
if (read(fd, (void *) buf, (size_t) BUF_SIZE - 1) >= 0) {
|
||||||
buf[16] = '\0';
|
buf[BUF_SIZE] = '\0';
|
||||||
close(fd);
|
close(fd);
|
||||||
if (c_streq(buf, "SQLite format 3")) {
|
if (c_streq(buf, "SQLite format 3")) {
|
||||||
if (sqlite3_open(journal, &db ) == SQLITE_OK) {
|
if (sqlite3_open(journal, &db ) == SQLITE_OK) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче