* libmisc/getlong.c: Make sure the getlong argument is not empty.

This commit is contained in:
nekral-guest 2009-03-08 20:21:24 +00:00
parent f47d9eba94
commit 186ea0e203
2 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2009-03-07 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/getlong.c: Make sure the getlong argument is not empty.
2009-03-07 Nicolas François <nicolas.francois@centraliens.net>
* contrib/adduser-old.c, contrib/adduser.c: Do not use the target

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007 - 2008, Nicolas François
* Copyright (c) 2007 - 2009, Nicolas François
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -34,14 +34,14 @@
#include "prototypes.h"
#include "defines.h"
int getlong(const char *numstr, long int *result)
int getlong (const char *numstr, long int *result)
{
long val;
char *endptr;
errno = 0;
val = strtol (numstr, &endptr, 10);
if (('\0' != *endptr) || (ERANGE == errno)) {
if (('\0' == numstr) || ('\0' != *endptr) || (ERANGE == errno)) {
return 0;
}