website

#astro#js#html#css

git clone https://git.pyrossh.dev/website

木 Personal website of pyrossh. Built with astrojs, shiki, vite.


19e7e03pyrossh 2026-07-14T13:37:16+05:30
fix: s3.getObject dangling pointer, type mismatch in signedHeaders
Files changed (1) hide show
  1. src/s3.zig +2 -2
src/s3.zig CHANGED
@@ -39,7 +39,7 @@ pub fn getObject(self: S3, key: []const u8) ?[]const u8 {
39
39
  defer resp.deinit(self.allocator);
40
40
 
41
41
  if (resp.status != .ok and resp.status != .no_content) return null;
42
- return resp.body;
42
+ return self.allocator.dupe(u8, resp.body) catch null;
43
43
  }
44
44
 
45
45
  pub fn getObjectArrayBuffer(self: S3, key: []const u8) ?[]u8 {
@@ -118,5 +118,5 @@ fn signedHeaders(self: S3, method: []const u8, key: []const u8, content_type: []
118
118
  // Simplified signing — for R2 with proper IAM, this may need full SigV4.
119
119
  // R2 supports AWS SigV4-compatible signing.
120
120
  // For now, returns a minimal auth header.
121
- return std.fmt.allocPrint(self.allocator, "Bearer {s}", .{self.secret_key}) catch "";
121
+ return std.fmt.allocPrint(self.allocator, "Bearer {s}", .{self.secret_key}) catch @as([]u8, &.{});
122
122
  }