Skip to content
Snippets Groups Projects
Commit d20b7807 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix a few impossible issues "found" by Coverity.

parent 6ca95ad4
No related branches found
No related tags found
No related merge requests found
......@@ -1094,13 +1094,13 @@ edit_name(char *itemname, struct bbslist **list, str_list_t inifile, bool edit_t
uifc.helpbuf = "`Directory Entry Name`\n\n"
"Enter the name of the entry as it is to appear in the directory.";
if (itemname)
strcpy(tmp, itemname);
strlcpy(tmp, itemname, sizeof(tmp));
if (uifc.input(WIN_MID | WIN_SAV, 0, 0, "Name", tmp, LIST_NAME_MAX, K_EDIT) == -1)
return false;
check_exit(false);
if (quitting)
return false;
if ((edit_to_add || stricmp(tmp, itemname)) && list_name_check(list, tmp, NULL, false)) {
if ((edit_to_add || (itemname != NULL && stricmp(tmp, itemname))) && list_name_check(list, tmp, NULL, false)) {
uifc.helpbuf = "`Entry Name Already Exists`\n\n"
"An entry with that name already exists in the directory.\n"
"Please choose a unique name.\n";
......
......@@ -271,6 +271,7 @@ modem_connect(struct bbslist *bbs)
/* Drain modem output buffer */
while (comReadByte(com, (uchar*)respbuf))
;
respbuf[0] = 0;
if (!bbs->hidepopups)
uifc.pop("Initializing...");
......
......@@ -3088,8 +3088,8 @@ read_jxl(const char *fn)
struct xpmapping *map = xpmap(fn, XPMAP_READ);
struct ciolib_pixels *pret = NULL;
uint8_t *pbuf = NULL;
uintmax_t width;
uintmax_t height;
uintmax_t width = 0;
uintmax_t height = 0;
if (map == NULL)
return map;
......@@ -3151,15 +3151,22 @@ read_jxl(const char *fn)
#endif
break;
case JXL_DEC_NEED_IMAGE_OUT_BUFFER:
if (width == 0 || height == 0 || width >= 0x40000000 || hewight >= 0x40000000) {
done = true;
break;
}
if (Jxl.DecoderImageOutBufferSize(dec, &format, &sz) != JXL_DEC_SUCCESS) {
done = true;
break;
}
// This may break things, but Coverity wants it.
free(pbuf);
pbuf = malloc(sz);
if (pbuf == NULL) {
done = true;
break;
}
freepixels(pret);
pret = alloc_ciolib_pixels(width, height);
if (pret == NULL) {
done = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment