@@ -15,6 +15,9 @@ const (
15
15
sshFileXferAttrPermissions = 0x00000004
16
16
sshFileXferAttrACmodTime = 0x00000008
17
17
sshFileXferAttrExtented = 0x80000000
18
+
19
+ sshFileXferAttrAll = sshFileXferAttrSize | sshFileXferAttrUIDGID | sshFileXferAttrPermissions |
20
+ sshFileXferAttrACmodTime | sshFileXferAttrExtented
18
21
)
19
22
20
23
// fileInfo is an artificial type designed to satisfy os.FileInfo.
@@ -102,30 +105,30 @@ func unmarshalAttrs(b []byte) (*FileStat, []byte) {
102
105
func getFileStat (flags uint32 , b []byte ) (*FileStat , []byte ) {
103
106
var fs FileStat
104
107
if flags & sshFileXferAttrSize == sshFileXferAttrSize {
105
- fs .Size , b = unmarshalUint64 (b )
108
+ fs .Size , b , _ = unmarshalUint64Safe (b )
106
109
}
107
110
if flags & sshFileXferAttrUIDGID == sshFileXferAttrUIDGID {
108
- fs .UID , b = unmarshalUint32 (b )
111
+ fs .UID , b , _ = unmarshalUint32Safe (b )
109
112
}
110
113
if flags & sshFileXferAttrUIDGID == sshFileXferAttrUIDGID {
111
- fs .GID , b = unmarshalUint32 (b )
114
+ fs .GID , b , _ = unmarshalUint32Safe (b )
112
115
}
113
116
if flags & sshFileXferAttrPermissions == sshFileXferAttrPermissions {
114
- fs .Mode , b = unmarshalUint32 (b )
117
+ fs .Mode , b , _ = unmarshalUint32Safe (b )
115
118
}
116
119
if flags & sshFileXferAttrACmodTime == sshFileXferAttrACmodTime {
117
- fs .Atime , b = unmarshalUint32 (b )
118
- fs .Mtime , b = unmarshalUint32 (b )
120
+ fs .Atime , b , _ = unmarshalUint32Safe (b )
121
+ fs .Mtime , b , _ = unmarshalUint32Safe (b )
119
122
}
120
123
if flags & sshFileXferAttrExtented == sshFileXferAttrExtented {
121
124
var count uint32
122
- count , b = unmarshalUint32 (b )
125
+ count , b , _ = unmarshalUint32Safe (b )
123
126
ext := make ([]StatExtended , count )
124
127
for i := uint32 (0 ); i < count ; i ++ {
125
128
var typ string
126
129
var data string
127
- typ , b = unmarshalString (b )
128
- data , b = unmarshalString (b )
130
+ typ , b , _ = unmarshalStringSafe (b )
131
+ data , b , _ = unmarshalStringSafe (b )
129
132
ext [i ] = StatExtended {typ , data }
130
133
}
131
134
fs .Extended = ext
0 commit comments