[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 04/13: libdiskfs: fix string termination
From: |
Samuel Thibault |
Subject: |
[hurd] 04/13: libdiskfs: fix string termination |
Date: |
Wed, 26 Mar 2014 12:12:15 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 52fdfc82a1ceef6251f816c64fc64fc78bd9b3e8
Author: Justus Winter <address@hidden>
Date: Thu Mar 20 13:34:02 2014 +0100
libdiskfs: fix string termination
Found using the Clang Static Analyzer.
* libdiskfs/fsys-getroot.c (diskfs_S_fsys_getroot): Fix string
termination.
---
libdiskfs/fsys-getroot.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/libdiskfs/fsys-getroot.c b/libdiskfs/fsys-getroot.c
index 5212214..10793c8 100644
--- a/libdiskfs/fsys-getroot.c
+++ b/libdiskfs/fsys-getroot.c
@@ -101,15 +101,17 @@ diskfs_S_fsys_getroot (struct diskfs_control *pt,
{
/* Handle symlink interpretation */
char pathbuf[diskfs_root_node->dn_stat.st_size + 1];
- size_t amt;
if (diskfs_read_symlink_hook)
err = (*diskfs_read_symlink_hook) (diskfs_root_node, pathbuf);
if (!diskfs_read_symlink_hook || err == EINVAL)
- err = diskfs_node_rdwr (diskfs_root_node, pathbuf, 0,
+ {
+ size_t amt = 0;
+ err = diskfs_node_rdwr (diskfs_root_node, pathbuf, 0,
diskfs_root_node->dn_stat.st_size, 0,
0, &amt);
- pathbuf[amt] = '\0';
+ pathbuf[amt] = '\0';
+ }
pthread_mutex_unlock (&diskfs_root_node->lock);
pthread_rwlock_unlock (&diskfs_fsys_lock);
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 05/13: hurd: fix receiver type, honor DEFAULT_PAGER_IMPORTS, (continued)
- [hurd] 05/13: hurd: fix receiver type, honor DEFAULT_PAGER_IMPORTS, Samuel Thibault, 2014/03/26
- [hurd] 07/13: mach-defpager: fix local includes, Samuel Thibault, 2014/03/26
- [hurd] 12/13: Handle fonts with multiple-of-8 bbox width, Samuel Thibault, 2014/03/26
- [hurd] 01/13: libpager: fix comment of pager_change_attributes, Samuel Thibault, 2014/03/26
- [hurd] 13/13: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2014/03/26
- [hurd] 11/13: Fix setting LGE flag, Samuel Thibault, 2014/03/26
- [hurd] 09/13: Align VGA buffers, Samuel Thibault, 2014/03/26
- [hurd] 08/13: mach-defpager: replace the magic typecast with a hash table, Samuel Thibault, 2014/03/26
- [hurd] 03/13: isofs: also copy the terminating zero in read_symlink_hook, Samuel Thibault, 2014/03/26
- [hurd] 06/13: mach-defpager: fix receiver lookups, Samuel Thibault, 2014/03/26
- [hurd] 04/13: libdiskfs: fix string termination,
Samuel Thibault <=
- [hurd] 02/13: libpager: fix potential deadlock, Samuel Thibault, 2014/03/26