Replace the hardcode max path length with PATH_MAX
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com> Change-Id: Icb1d36b48a759ec11dbaa4c09a39037a80ab0f85
Этот коммит содержится в:
родитель
ae44d846b8
Коммит
d2182bb7af
@ -17,6 +17,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <sys/select.h>
|
||||
#include <sys/time.h>
|
||||
@ -297,7 +298,7 @@ static void shell(ssh_session session)
|
||||
static void batch_shell(ssh_session session)
|
||||
{
|
||||
ssh_channel channel;
|
||||
char buffer[1024];
|
||||
char buffer[PATH_MAX];
|
||||
size_t i;
|
||||
int s = 0;
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#ifndef _LIBSSH_PRIV_H
|
||||
#define _LIBSSH_PRIV_H
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -167,6 +168,10 @@ int gettimeofday(struct timeval *__p, void *__t);
|
||||
#include "libssh/callbacks.h"
|
||||
|
||||
/* some constants */
|
||||
#ifndef PATH_MAX
|
||||
# define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
#ifndef MAX_PACKET_LEN
|
||||
#define MAX_PACKET_LEN 262144
|
||||
#endif
|
||||
|
@ -1103,7 +1103,7 @@ int ssh_userauth_publickey_auto(ssh_session session,
|
||||
|
||||
while (state->it != NULL) {
|
||||
const char *privkey_file = state->it->data;
|
||||
char pubkey_file[1024] = {0};
|
||||
char pubkey_file[PATH_MAX] = {0};
|
||||
|
||||
if (state->state == SSH_AUTH_AUTO_STATE_PUBKEY) {
|
||||
SSH_LOG(SSH_LOG_DEBUG,
|
||||
|
@ -119,7 +119,7 @@ error:
|
||||
int ssh_scp_init(ssh_scp scp)
|
||||
{
|
||||
int rc;
|
||||
char execbuffer[1024] = {0};
|
||||
char execbuffer[PATH_MAX] = {0};
|
||||
char *quoted_location = NULL;
|
||||
size_t quoted_location_len = 0;
|
||||
size_t scp_location_len;
|
||||
@ -319,7 +319,7 @@ void ssh_scp_free(ssh_scp scp)
|
||||
*/
|
||||
int ssh_scp_push_directory(ssh_scp scp, const char *dirname, int mode)
|
||||
{
|
||||
char buffer[1024] = {0};
|
||||
char buffer[PATH_MAX] = {0};
|
||||
int rc;
|
||||
char *dir = NULL;
|
||||
char *perms = NULL;
|
||||
@ -456,7 +456,7 @@ int ssh_scp_leave_directory(ssh_scp scp)
|
||||
int ssh_scp_push_file64(ssh_scp scp, const char *filename, uint64_t size,
|
||||
int mode)
|
||||
{
|
||||
char buffer[1024] = {0};
|
||||
char buffer[PATH_MAX] = {0};
|
||||
int rc;
|
||||
char *file = NULL;
|
||||
char *perms = NULL;
|
||||
@ -769,7 +769,7 @@ int ssh_scp_read_string(ssh_scp scp, char *buffer, size_t len)
|
||||
*/
|
||||
int ssh_scp_pull_request(ssh_scp scp)
|
||||
{
|
||||
char buffer[MAX_BUF_SIZE] = {0};
|
||||
char buffer[PATH_MAX] = {0};
|
||||
char *mode = NULL;
|
||||
char *p, *tmp;
|
||||
uint64_t size;
|
||||
|
@ -63,10 +63,6 @@
|
||||
#define TORTURE_SSHD_CONFIG "sshd/sshd_config"
|
||||
#define TORTURE_PCAP_FILE "socket_trace.pcap"
|
||||
|
||||
#ifndef PATH_MAX
|
||||
# define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
static const char torture_rsa_certauth_pub[]=
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCnA2n5vHzZbs/GvRkGloJNV1CXHI"
|
||||
"S5Xnrm05HusUJSWyPq3I1iCMHdYA7oezHa9GCFYbIenaYPy+G6USQRjYQz8SvAZo06"
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user