Skip to content

Commit 3f255c9

Browse files
authored
Merge pull request #2 from HakordiaNetwork/alert-autofix-11
Potential fix for code scanning alert no. 11: Type confusion through parameter tampering
2 parents aaef95c + 139de44 commit 3f255c9

File tree

1 file changed

+4
-0
lines changed
  • packages/amplify-storage-simulator/src/server

1 file changed

+4
-0
lines changed

packages/amplify-storage-simulator/src/server/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ export function checkFile(file: string, prefix: string, delimiter: string) {
5050

5151
// removing chunk siognature from request payload if present
5252
export function stripChunkSignature(buf: Buffer) {
53+
if (!Buffer.isBuffer(buf)) {
54+
// If buf is not a Buffer, return it unchanged or handle the error
55+
return buf;
56+
}
5357
const str = buf.toString();
5458
const regex = /^[A-Fa-f0-9]+;chunk-signature=[0-9a-f]{64}/gm;
5559
let m;

0 commit comments

Comments
 (0)