[Pkg-owncloud-commits] [owncloud-client] 101/332: csync: fix the size in strncpy for the remote perms

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Aug 14 21:06:45 UTC 2014


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 38254125c99d97360e1ac0ca21d5324bcadb6bf0
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Wed Jun 18 15:56:13 2014 +0200

    csync: fix the size in strncpy for the remote perms
    
    We must only do strncpy with size one smaller than
    the size of the buffer in order to leave at least
    one '\0' at the end
---
 csync/src/csync_statedb.c | 2 +-
 csync/src/csync_update.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/csync/src/csync_statedb.c b/csync/src/csync_statedb.c
index db56ae4..4272df0 100644
--- a/csync/src/csync_statedb.c
+++ b/csync/src/csync_statedb.c
@@ -314,7 +314,7 @@ static int _csync_file_stat_from_metadata_table( csync_file_stat_t **st, sqlite3
             if(column_count > 11 && sqlite3_column_text(stmt,11)) {
                 strncpy((*st)->remotePerm,
                         (char*) sqlite3_column_text(stmt, 11),
-                        sizeof((*st)->remotePerm));
+                        REMOTE_PERM_BUF_SIZE);
             }
         }
     }
diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c
index adc7785..504e680 100644
--- a/csync/src/csync_update.c
+++ b/csync/src/csync_update.c
@@ -390,7 +390,7 @@ out:
       st->directDownloadCookies = c_strdup(fs->directDownloadCookies);
   }
   if (fs->fields & CSYNC_VIO_FILE_STAT_FIELDS_PERM) {
-      strncpy(st->remotePerm, fs->remotePerm, sizeof(st->remotePerm));
+      strncpy(st->remotePerm, fs->remotePerm, REMOTE_PERM_BUF_SIZE);
   }
 
 fastout:  /* target if the file information is read from database into st */

-- 
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