NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lib/58453: endptr can be unitialized if an invalid base is passed to strto*(3)
>Number: 58453
>Category: lib
>Synopsis: endptr can be unitialized if an invalid base is passed to strto*(3)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 22 15:55:00 +0000 2024
>Originator: Christos Zoulas
>Release: NetBSD 10.99.11
>Organization:
Bogus Plans, Inc.
>Environment:
System: NetBSD quasar.astron.com 10.99.11 NetBSD 10.99.11 (QUASAR) #6: Wed Jul 10 03:34:01 EDT 2024 christos%quasar.astron.com@localhost:/usr/src/sys/arch/amd64/compile/QUASAR amd64
Architecture: x86_64
Machine: amd64
>Description:
Bug report from Alejandro Colomar:
https://lore.kernel.org/all/20240720190321.550121-2-alx%kernel.org@localhost/T/
>How-To-Repeat:
#include <sys/cdefs.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <limits.h>
#include <errno.h>
#ifndef __UNCONST
#define __UNCONST(a) (void *)(intptr_t)(a)
#endif
int
main(int argc, char *argv[])
{
char *endp = __UNCONST("boo");
errno = 0;
intmax_t im = strtoimax(argv[1], &endp, -2);
printf("%jd [%s] %d\n", im, endp, errno);
return 0;
}
Run on linux, observe it print "0 [boo] 22\n"
>Fix:
https://mail-index.netbsd.org/source-changes/2024/07/21/msg152491.html
Home |
Main Index |
Thread Index |
Old Index