Displaying 11 results from an estimated 11 matches for "do_readdir".
2015 Jan 20
9
[PATCH] daemon: readdir: fix invalid memory access on error
...b/daemon/readdir.c
@@ -27,6 +27,17 @@
#include "daemon.h"
#include "actions.h"
+static void
+free_int_dirent_list (guestfs_int_dirent *p, size_t len)
+{
+ size_t i;
+
+ for (i = 0; i < len; ++i) {
+ free (p[i].name);
+ }
+ free (p);
+}
+
guestfs_int_dirent_list *
do_readdir (const char *path)
{
@@ -64,8 +75,11 @@ do_readdir (const char *path)
v.name = strdup (d->d_name);
if (!p || !v.name) {
reply_with_perror ("allocate");
- free (ret->guestfs_int_dirent_list_val);
- free (p);
+ if (p) {
+ free_int_dirent_list (p...
2015 Jan 21
0
Re: [PATCH] daemon: readdir: fix invalid memory access on error
...#include "actions.h"
>
> +static void
> +free_int_dirent_list (guestfs_int_dirent *p, size_t len)
> +{
> + size_t i;
> +
> + for (i = 0; i < len; ++i) {
> + free (p[i].name);
> + }
> + free (p);
> +}
> +
> guestfs_int_dirent_list *
> do_readdir (const char *path)
> {
> @@ -64,8 +75,11 @@ do_readdir (const char *path)
> v.name = strdup (d->d_name);
> if (!p || !v.name) {
> reply_with_perror ("allocate");
> - free (ret->guestfs_int_dirent_list_val);
> - free (p);
> + i...
2002 Oct 18
1
Patch: sftp client support of "ls [flags] [path [localfile]]" feature
...* sftp-int.c.orig Wed Sep 11 20:34:15 2002
--- sftp-int.c Fri Oct 18 13:39:46 2002
***************
*** 555,567 ****
/* sftp ls.1 replacement for directories */
static int
! do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag)
{
int n;
SFTP_DIRENT **d;
if ((n = do_readdir(conn, path, &d)) != 0)
return (n);
/* Count entries for sort */
for (n = 0; d[n] != NULL; n++)
--- 555,587 ----
/* sftp ls.1 replacement for directories */
static int
! do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag,
! char *localpath)
{
int n...
2003 Oct 01
1
3.7.1p2 sftp recurse patch
...te_path)) {
+ if (!is_dir(local_path)) {
+ /* Create local directory */
+ err = mkdir(local_path, 0777);
+ if (err == -1) {
+ error("Couldn't create local directory \"%s\": "
+ "%s", local_path, strerror(errno));
+ goto END;
+ }
+ }
+
+ err = do_readdir(conn, remote_path, &d);
+ if (err == -1) {
+ error("Couldn't gather list of remote files");
+ goto END;
+ }
+
+ for (n = 0; d[n] != NULL; n++) {
+ /* Skip '.' and '..' */
+ if ((strcmp(d[n]->filename, ".") == 0) ||
+ (strcmp(d[n]->...
2008 Jul 21
2
sftp needs a long time for sending a filelist
Hello all
Im using sftp 1:4.7p1-8ubuntu1.2
in a batchjob
Ive noticed that sftp needs a long time for sending a filelist.
The timespan increases exponential if many files are on the
remoteserver.
for example "ls -la *.txt" needs 10 seconds for 2000 files
but needs 50 seconds for 4000 files.
For 150.000 Files i have to wait 15 minutes for example
but the
2014 Jan 30
0
Announce: OpenSSH 6.5 released
...y).
* sshd(8): bz#1297: tell the client (via a debug message) when
their preferred listen address has been overridden by the
server's GatewayPorts setting.
* sshd(8): bz#2162: include report port in bad protocol banner
message.
* sftp(1): bz#2163: fix memory leak in error path in do_readdir().
* sftp(1): bz#2171: don't leak file descriptor on error.
* sshd(8): Include the local address and port in "Connection from
..." message (only shown at loglevel>=verbose).
Portable OpenSSH:
* Please note that this is the last version of Portable OpenSSH that
will sup...
2014 Jan 30
1
Announce: OpenSSH 6.5 released
...y).
* sshd(8): bz#1297: tell the client (via a debug message) when
their preferred listen address has been overridden by the
server's GatewayPorts setting.
* sshd(8): bz#2162: include report port in bad protocol banner
message.
* sftp(1): bz#2163: fix memory leak in error path in do_readdir().
* sftp(1): bz#2171: don't leak file descriptor on error.
* sshd(8): Include the local address and port in "Connection from
..." message (only shown at loglevel>=verbose).
Portable OpenSSH:
* Please note that this is the last version of Portable OpenSSH that
will sup...
2014 Jan 17
15
Call for testing: OpenSSH-6.5
...y).
* sshd(8): bz#1297: tell the client (via a debug message) when
their preferred listen address has been overridden by the
server's GatewayPorts setting.
* sshd(8): bz#2162: include report port in bad protocol banner
message.
* sftp(1): bz#2163: fix memory leak in error path in do_readdir()
* sftp(1): bz#2171: don't leak file descriptor on error.
* sshd(8): Include the local address and port in "Connection from
..." message (only shown at loglevel>=verbose)
Portable OpenSSH:
* Switch to a ChaCha20-based arc4random() PRNG for platforms that do
not provid...
2009 Aug 12
23
[PATCH 0/23] factor and const-correctness
This started as a simple warning-elimination change.
I'll get back to that series shortly ;-)
It turned into a factorization and constification exercise
during which I got a taste of ocaml. Thanks to Rich Jones
for help with a few snippets in generator.ml.
The overall result is that many previously-manually-maintained
bits from daemon/*.c functions are now hoisted into the automatically-
2012 Mar 13
2
[PATCH 0/2] 'int' to 'size_t' changes
These two patches are probably not completely independent, but
separating them is a lot of work.
With *both* patches applied, all the tests and extra-tests pass.
That's no guarantee however that there isn't a mistake, so I don't
think this patch is a candidate for the 1.16 branch, until it's had a
lot more testing in development.
Rich.
2009 Aug 03
1
[PATCH 1/2] Convert all TABs-as-indentation to spaces.
...ncellation: read 0x%x from library, expected 0x%x\n",
- flag, GUESTFS_CANCEL_FLAG);
+ flag, GUESTFS_CANCEL_FLAG);
return 0;
}
diff --git a/daemon/readdir.c b/daemon/readdir.c
index e3851db..17fc619 100644
--- a/daemon/readdir.c
+++ b/daemon/readdir.c
@@ -63,7 +63,7 @@ do_readdir (char *path)
guestfs_int_dirent *p;
p = realloc (ret->guestfs_int_dirent_list_val,
- sizeof (guestfs_int_dirent) * (i+1));
+ sizeof (guestfs_int_dirent) * (i+1));
v.name = strdup (d->d_name);
if (!p || !v.name) {
reply_with_perror ("allocate&...