[Pkg-owncloud-commits] [owncloud-client] 130/498: DiscoveryPhase: Fix the unlikely case the server resturns utf-8 in permissions
Sandro Knauß
hefee-guest at moszumanska.debian.org
Tue Aug 11 14:48:43 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 6df7551bddc29d7372a3e4f9828810898cb70b79
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Mon Jun 8 15:40:06 2015 +0200
DiscoveryPhase: Fix the unlikely case the server resturns utf-8 in permissions
UTF-8 size might be bigger than the size of the QString
In that case we would end up with a non-nill terminated permissions.
---
src/libsync/discoveryphase.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp
index 38aa83c..02d034d 100644
--- a/src/libsync/discoveryphase.cpp
+++ b/src/libsync/discoveryphase.cpp
@@ -217,17 +217,18 @@ static csync_vio_file_stat_t* propertyMapToFileStat(QMap<QString,QString> map)
file_stat->directDownloadCookies = strdup(value.toUtf8());
file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_DIRECTDOWNLOADCOOKIES;
} else if (property == "permissions") {
+ auto v = value.toUtf8();
if (value.isEmpty()) {
// special meaning for our code: server returned permissions but are empty
// meaning only reading is allowed for this resource
file_stat->remotePerm[0] = ' ';
// see _csync_detect_update()
file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_PERM;
- } else if (value.length() < int(sizeof(file_stat->remotePerm))) {
- strncpy(file_stat->remotePerm, value.toUtf8(), sizeof(file_stat->remotePerm));
+ } else if (v.length() < int(sizeof(file_stat->remotePerm))) {
+ strncpy(file_stat->remotePerm, v.constData(), sizeof(file_stat->remotePerm));
file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_PERM;
} else {
- // old server, keep file_stat->remotePerm empty
+ qWarning() << "permissions too large" << v;
}
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list