mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-25 22:05:53 +03:00
Check for valid result count after query.
This commit is contained in:
parent
78c43e542c
commit
c491e8bb68
1 changed files with 22 additions and 17 deletions
|
@ -399,6 +399,7 @@ csync_file_stat_t *csync_statedb_get_stat_by_hash(CSYNC *ctx, uint64_t phash) {
|
||||||
if (result->count < 10) {
|
if (result->count < 10) {
|
||||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "WRN: Amount of result columns wrong, db version mismatch!");
|
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "WRN: Amount of result columns wrong, db version mismatch!");
|
||||||
}
|
}
|
||||||
|
if(result->count > 7) {
|
||||||
/* phash, pathlen, path, inode, uid, gid, mode, modtime */
|
/* phash, pathlen, path, inode, uid, gid, mode, modtime */
|
||||||
len = strlen(result->vector[2]);
|
len = strlen(result->vector[2]);
|
||||||
st = c_malloc(sizeof(csync_file_stat_t) + len + 1);
|
st = c_malloc(sizeof(csync_file_stat_t) + len + 1);
|
||||||
|
@ -427,6 +428,10 @@ csync_file_stat_t *csync_statedb_get_stat_by_hash(CSYNC *ctx, uint64_t phash) {
|
||||||
st->gid = atoi(result->vector[5]);
|
st->gid = atoi(result->vector[5]);
|
||||||
st->mode = atoi(result->vector[6]);
|
st->mode = atoi(result->vector[6]);
|
||||||
st->modtime = strtoul(result->vector[7], NULL, 10);
|
st->modtime = strtoul(result->vector[7], NULL, 10);
|
||||||
|
} else {
|
||||||
|
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "No result record found for phash = %llu",
|
||||||
|
(long long unsigned int) phash);
|
||||||
|
}
|
||||||
|
|
||||||
if(result->count > 8 && result->vector[8]) {
|
if(result->count > 8 && result->vector[8]) {
|
||||||
st->type = atoi(result->vector[8]);
|
st->type = atoi(result->vector[8]);
|
||||||
|
|
Loading…
Reference in a new issue