* libmisc/getlong.c: Make sure the getlong argument is not empty.
This commit is contained in:
parent
f47d9eba94
commit
186ea0e203
@ -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>
|
2009-03-07 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* contrib/adduser-old.c, contrib/adduser.c: Do not use the target
|
* contrib/adduser-old.c, contrib/adduser.c: Do not use the target
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 - 2008, Nicolas François
|
* Copyright (c) 2007 - 2009, Nicolas François
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -34,14 +34,14 @@
|
|||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
|
||||||
int getlong(const char *numstr, long int *result)
|
int getlong (const char *numstr, long int *result)
|
||||||
{
|
{
|
||||||
long val;
|
long val;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
val = strtol (numstr, &endptr, 10);
|
val = strtol (numstr, &endptr, 10);
|
||||||
if (('\0' != *endptr) || (ERANGE == errno)) {
|
if (('\0' == numstr) || ('\0' != *endptr) || (ERANGE == errno)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user