alpine 3.6
access weakness #298

1

Weakness Breakdown


Definition:

An access weakness occurs when software does not properly implement permissions that could have unintended consequences if exploited by malicious actors. An example of this weakness is when a default username and password are set by the developer but do not get changed by the system administrator.

Warning code(s):

Ensure that umask is given most restrictive possible setting.

File Name:

mmh/src/mmh-0.3/uip/scansbr.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.6 access weakness.

 #define SCAN_CHARWIDTH 1
#endif

int
scan(FILE *inb, int innum, int outnum, char *fmtstr, int width, int curflg,
	int unseen)
{
	static int slwidth;
	int compnum, i;
	enum state state;
	struct field f = {{0}};
	char *cp;
	struct comp *cptr;
	char *scnmsg = NULL;
	FILE *scnout = NULL;
	int incing = (outnum != SCN_MBOX && outnum != SCN_FOLD);
	int scanfolder = (outnum == SCN_FOLD);
	long fpos;
	struct stat st;
	int blankline;

	/* first-time only initialization */
	if (!scanl) {
		if (incing)
			umask(~m_gmprot());

		if (fmtstr) {
			if (width == 0) {
				if ((width = sc_width()) < WIDTH/2)
					width = WIDTH/2;
				else if (width > MAXSCANL)
					width = MAXSCANL;
			}
			dat[3] = slwidth = width;
			scanl = mh_xcalloc(slwidth + 2, SCAN_CHARWIDTH);  /* probably for \n and \0 */
			/* Compile format string */
			ncomps = fmt_compile(fmtstr, &fmt) + 1;
			FINDCOMP(datecomp, "date");
		} else {
			ncomps = 1;
			datecomp = NULL;
		}
	}

	if (feof(inb)) {
		return SCNEOF;
	}

	/*
	** each-message initialization 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.