1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
commit f30ac3cc1a58ec7522de6aeeaa09314a45dbc690
Author: TJ Saunders <tj@castaglia.org>
Date: Sat Nov 28 17:13:55 2015 -0800
Correct the parameters to talk of "extended attributes", not SFTP extensions.
diff --git a/contrib/mod_sftp/fxp.c b/contrib/mod_sftp/fxp.c
index 03c7eb5..e7161d5 100644
--- a/contrib/mod_sftp/fxp.c
+++ b/contrib/mod_sftp/fxp.c
@@ -235,15 +235,18 @@ static size_t fxp_packet_data_allocsz = 0;
#define FXP_PACKET_DATA_DEFAULT_SZ (1024 * 16)
#define FXP_RESPONSE_DATA_DEFAULT_SZ 512
+#define FXP_MAX_PACKET_LEN (1024 * 512)
+#define FXP_MAX_EXTENDED_ATTRIBUTES 100
+
+/* Maximum length of SFTP extended attribute name OR value. */
+#define FXP_MAX_EXTENDED_ATTR_LEN 1024
+
struct fxp_extpair {
char *ext_name;
uint32_t ext_datalen;
unsigned char *ext_data;
};
-/* Maximum length of SFTP extension name, AND of the extension value. */
-#define SFTP_EXT_MAX_LEN 1024
-
static pool *fxp_pool = NULL;
static int fxp_use_gmt = TRUE;
@@ -1243,10 +1246,10 @@ static struct fxp_extpair *fxp_msg_read_extpair(pool *p, unsigned char **buf,
SFTP_DISCONNECT_CONN(SFTP_SSH2_DISCONNECT_BY_APPLICATION, NULL);
}
- if (namelen > SFTP_EXT_MAX_LEN) {
+ if (namelen > FXP_MAX_EXTENDED_ATTR_LEN) {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
- "received too-long SFTP extension name (%lu > max %lu), ignoring",
- (unsigned long) namelen, (unsigned long) SFTP_EXT_MAX_LEN);
+ "received too-long extended attribute name (%lu > max %lu), ignoring",
+ (unsigned long) namelen, (unsigned long) FXP_MAX_EXTENDED_ATTR_LEN);
errno = EINVAL;
return NULL;
}
@@ -1259,10 +1262,11 @@ static struct fxp_extpair *fxp_msg_read_extpair(pool *p, unsigned char **buf,
datalen = sftp_msg_read_int(p, buf, buflen);
if (datalen > 0) {
- if (datalen > SFTP_EXT_MAX_LEN) {
+ if (datalen > FXP_MAX_EXTENDED_ATTR_LEN) {
(void) pr_log_writefile(sftp_logfd, MOD_SFTP_VERSION,
- "received too-long SFTP extension '%s' data (%lu > max %lu), ignoring",
- name, (unsigned long) datalen, (unsigned long) SFTP_EXT_MAX_LEN);
+ "received too-long extended attribute '%s' value (%lu > max %lu), "
+ "ignoring", name, (unsigned long) datalen,
+ (unsigned long) FXP_MAX_EXTENDED_ATTR_LEN);
errno = EINVAL;
return NULL;
}
|