94 lines
3.0 KiB
Diff
94 lines
3.0 KiB
Diff
diff -up kbd-2.4.0/src/libkbdfile/kbdfile.c.orig kbd-2.4.0/src/libkbdfile/kbdfile.c
|
|
--- kbd-2.4.0/src/libkbdfile/kbdfile.c.orig 2020-11-11 13:44:48.000000000 +0100
|
|
+++ kbd-2.4.0/src/libkbdfile/kbdfile.c 2021-04-27 09:58:08.405671071 +0200
|
|
@@ -39,8 +39,10 @@ kbdfile_new(struct kbdfile_ctx *ctx)
|
|
|
|
if (!fp->ctx) {
|
|
fp->ctx = kbdfile_context_new();
|
|
- if (!fp->ctx)
|
|
+ if (!fp->ctx) {
|
|
+ free(fp);
|
|
return NULL;
|
|
+ }
|
|
fp->flags |= KBDFILE_CTX_INITIALIZED;
|
|
}
|
|
|
|
@@ -69,7 +71,7 @@ kbdfile_get_pathname(struct kbdfile *fp)
|
|
int
|
|
kbdfile_set_pathname(struct kbdfile *fp, const char *pathname)
|
|
{
|
|
- strncpy(fp->pathname, pathname, sizeof(fp->pathname));
|
|
+ strncpy(fp->pathname, pathname, sizeof(fp->pathname) - 1);
|
|
return 0;
|
|
}
|
|
|
|
@@ -385,7 +387,7 @@ kbdfile_find(const char *fnam, const cha
|
|
fp->flags &= ~KBDFILE_PIPE;
|
|
|
|
/* Try explicitly given name first */
|
|
- strncpy(fp->pathname, fnam, sizeof(fp->pathname));
|
|
+ strncpy(fp->pathname, fnam, sizeof(fp->pathname) - 1);
|
|
|
|
if (!maybe_pipe_open(fp))
|
|
return 0;
|
|
diff -up kbd-2.4.0/src/libkeymap/common.c.orig kbd-2.4.0/src/libkeymap/common.c
|
|
--- kbd-2.4.0/src/libkeymap/common.c.orig 2019-06-24 13:55:23.000000000 +0200
|
|
+++ kbd-2.4.0/src/libkeymap/common.c 2021-04-27 09:58:08.405671071 +0200
|
|
@@ -139,6 +139,7 @@ init_array(struct lk_ctx *ctx, struct lk
|
|
rc = lk_array_init(ptr, size, 0);
|
|
if (rc < 0) {
|
|
ERR(ctx, _("unable to initialize array: %s"), strerror(rc));
|
|
+ free(ptr);
|
|
return -1;
|
|
}
|
|
|
|
diff -up kbd-2.4.0/src/libkfont/psffontop.c.orig kbd-2.4.0/src/libkfont/psffontop.c
|
|
--- kbd-2.4.0/src/libkfont/psffontop.c.orig 2020-04-27 17:53:01.000000000 +0200
|
|
+++ kbd-2.4.0/src/libkfont/psffontop.c 2021-04-27 09:59:14.170153676 +0200
|
|
@@ -235,6 +235,7 @@ kfont_read_psffont(struct kfont_context
|
|
|
|
if (psfhdr->mode > PSF1_MAXMODE) {
|
|
KFONT_ERR(ctx, _("Unsupported psf file mode (%d)"), psfhdr->mode);
|
|
+ free(psfhdr);
|
|
return -EX_DATAERR;
|
|
}
|
|
fontlen = ((psfhdr->mode & PSF1_MODE512) ? 512 : 256);
|
|
@@ -251,6 +252,7 @@ kfont_read_psffont(struct kfont_context
|
|
|
|
if (psfhdr.version > PSF2_MAXVERSION) {
|
|
KFONT_ERR(ctx, _("Unsupported psf version (%d)"), psfhdr.version);
|
|
+ free(inputbuf);
|
|
return -EX_DATAERR;
|
|
}
|
|
fontlen = assemble_uint32((unsigned char *)&psfhdr.length);
|
|
@@ -260,16 +262,20 @@ kfont_read_psffont(struct kfont_context
|
|
ftoffset = assemble_uint32((unsigned char *)&psfhdr.headersize);
|
|
fontwidth = assemble_uint32((unsigned char *)&psfhdr.width);
|
|
utf8 = 1;
|
|
- } else
|
|
+ } else {
|
|
+ free(inputbuf);
|
|
return -EX_DATAERR; /* not psf */
|
|
+ }
|
|
|
|
/* tests required - we divide by these */
|
|
if (fontlen == 0) {
|
|
KFONT_ERR(ctx, _("zero input font length?"));
|
|
+ free(inputbuf);
|
|
return -EX_DATAERR;
|
|
}
|
|
if (charsize == 0) {
|
|
KFONT_ERR(ctx, _("zero input character size?"));
|
|
+ free(inputbuf);
|
|
return -EX_DATAERR;
|
|
}
|
|
|
|
@@ -277,6 +283,7 @@ kfont_read_psffont(struct kfont_context
|
|
|
|
if (i > inputlth || (!hastable && i != inputlth)) {
|
|
KFONT_ERR(ctx, _("Input file: bad input length (%d)"), inputlth);
|
|
+ free(inputbuf);
|
|
return -EX_DATAERR;
|
|
}
|
|
|