Cast the value returned by strtoul() to a uintptr_t before casting

it to a pointer.  There's nothing better than strtoul() for reading
pointers from strings, but the range checking should be better.
This commit is contained in:
Bruce Evans 1998-07-15 04:03:54 +00:00
parent fc93c1bd67
commit 4b81ec76d1

View File

@ -46,7 +46,7 @@
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
** $Id: userconfig.c,v 1.102 1998/02/10 00:10:35 msmith Exp $
** $Id: userconfig.c,v 1.103 1998/03/10 08:03:47 jkh Exp $
**/
/**
@ -2379,7 +2379,7 @@ visuserconfig(void)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: userconfig.c,v 1.102 1998/02/10 00:10:35 msmith Exp $
* $Id: userconfig.c,v 1.103 1998/03/10 08:03:47 jkh Exp $
*/
#include "scbus.h"
@ -2623,7 +2623,7 @@ parse_args(char *cmd, CmdParm *parms)
continue;
}
if (parms->type == PARM_ADDR) {
parms->parm.aparm = (void *)strtoul(cmd, &ptr, 0);
parms->parm.aparm = (void *)(uintptr_t)strtoul(cmd, &ptr, 0);
if (cmd == ptr) {
printf("Invalid address argument\n");
return 1;