diff --git a/ChangeLog b/ChangeLog index 566937ca..efa98c80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-03-07 Nicolas François + + * libmisc/getlong.c: Make sure the getlong argument is not empty. + 2009-03-07 Nicolas François * contrib/adduser-old.c, contrib/adduser.c: Do not use the target diff --git a/libmisc/getlong.c b/libmisc/getlong.c index 7c3d2ce0..48914b37 100644 --- a/libmisc/getlong.c +++ b/libmisc/getlong.c @@ -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; }