Skip to content

Commit 25e52cb

Browse files
committed
Add prototypes for functions returning pointers and modify how some arrays are defined
Functions not declared before use, are define as returning an int. Under 64-bit this can result in corrupted pointers being returned. Also, Visual studio doesn't like it when you use variables to declare array sizes, static values always work though.
1 parent c2c272e commit 25e52cb

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

contrib/win32/win32compat/pwd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#include "homedirhelp.h"
4444

4545

46+
char *GetHomeDirFromToken(char *userName, HANDLE token);
47+
4648
uid_t getuid(void)
4749
{
4850
return 0;

readpass.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ ssh_askpass(char *askpass, const char *msg)
146146

147147
int length = 8192;
148148

149-
CHAR command[length];
149+
CHAR command[8192];
150150

151151
char *pass = NULL;
152152

serverloop.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,10 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
824824
/* NOTREACHED */
825825
}
826826

827+
#ifdef WIN32_FIXME
828+
Session * session_get(int *);
829+
#endif
830+
827831
static void
828832
collect_children(void)
829833
{

session.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@
105105
#include "sftp.h"
106106

107107
#ifdef WIN32_FIXME
108+
109+
char *GetHomeDirFromToken(char *userName, HANDLE token);
108110
/*
109111
FIXME: GFPZR: Function stat() may be undeclared.
110112
*/
@@ -873,7 +875,7 @@ do_exec_no_pty(Session *s, const char *command)
873875

874876
DWORD size = 256;
875877

876-
char name[size];
878+
char name[256];
877879

878880
GetUserName(name, &size);
879881

0 commit comments

Comments
 (0)