~mdw
/
sgt
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't offer repeat key exchange as a special command in SSH-1.
[sgt/putty]
/
sshcrcda.c
diff --git
a/sshcrcda.c
b/sshcrcda.c
index
2821020
..
09e5f8d
100644
(file)
--- a/
sshcrcda.c
+++ b/
sshcrcda.c
@@
-63,7
+63,7
@@
struct crcda_ctx {
void *crcda_make_context(void)
{
void *crcda_make_context(void)
{
- struct crcda_ctx *ret = s
malloc(sizeof(struct crcda_ctx)
);
+ struct crcda_ctx *ret = s
new(struct crcda_ctx
);
ret->h = NULL;
ret->n = HASH_MINSIZE / HASH_ENTRYSIZE;
return ret;
ret->h = NULL;
ret->n = HASH_MINSIZE / HASH_ENTRYSIZE;
return ret;
@@
-71,7
+71,12
@@
void *crcda_make_context(void)
void crcda_free_context(void *handle)
{
void crcda_free_context(void *handle)
{
- sfree(handle);
+ struct crcda_ctx *ctx = (struct crcda_ctx *)handle;
+ if (ctx) {
+ sfree(ctx->h);
+ ctx->h = NULL;
+ sfree(ctx);
+ }
}
static void crc_update(uint32 *a, void *b)
}
static void crc_update(uint32 *a, void *b)
@@
-118,11
+123,11
@@
int detect_attack(void *handle, uchar *buf, uint32 len, uchar *IV)
if (ctx->h == NULL) {
ctx->n = l;
if (ctx->h == NULL) {
ctx->n = l;
- ctx->h =
(uint16 *) smalloc(ctx->n * HASH_ENTRYSIZE
);
+ ctx->h =
snewn(ctx->n, uint16
);
} else {
if (l > ctx->n) {
ctx->n = l;
} else {
if (l > ctx->n) {
ctx->n = l;
- ctx->h =
(uint16 *) srealloc(ctx->h, ctx->n * HASH_ENTRYSIZE
);
+ ctx->h =
sresize(ctx->h, ctx->n, uint16
);
}
}
}
}