alpine 3.6
obsolete weakness #13

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

gpsd/src/gpsd-3.16/contrib/ashctl.c

Context:

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

 			sum ^= c;
			p++;
		}
		*p++ = '*';
		(void)snprintf(p, 5, "%02X\r\n", (unsigned int)sum);
	}
}

static int nmea_send(int fd, const char *fmt, ... )
/* ship a command to the GPS, adding * and correct checksum */
{
	size_t status;
	char buf[BUFSIZ];
	va_list ap;

	va_start(ap, fmt) ;
	(void)vsnprintf(buf, sizeof(buf)-5, fmt, ap);
	va_end(ap);
	(void)strncat(buf, "*", sizeof(buf)-1);
	nmea_add_checksum(buf);
	// (void)fputs(buf, stderr); /* debug output */
	tcflush(fd, TCIOFLUSH);
	status = (size_t)write(fd, buf, strlen(buf));
	tcdrain(fd);
	usleep(100000);
	if (status == strlen(buf)) {
		return (int)status;
	} else {
		perror("nmea_send");
		return -1;
	}
} 

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.