diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2011-08-27 22:57:18 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2011-08-27 22:57:18 +0200 |
commit | db932574059069ddb8b3fe2b8c06ca854fff7342 (patch) | |
tree | 72bca1bd856625e672d908a39d6ea19baae18c52 /nslcd/service.c | |
parent | b098356bae29e30f3bc81e8af06c1e9e16ad7db2 (diff) |
check errno after calls to strtol() to ensure that numbers that are too large for type will be reported (thanks Jakub Hrozek)
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1523 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd/service.c')
-rw-r--r-- | nslcd/service.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nslcd/service.c b/nslcd/service.c index 3c487f7..4a43022 100644 --- a/nslcd/service.c +++ b/nslcd/service.c @@ -5,7 +5,7 @@ Copyright (C) 1997-2005 Luke Howard Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2009, 2010 Arthur de Jong + Copyright (C) 2006, 2007, 2009, 2010, 2011 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -172,6 +172,7 @@ static int write_service(TFILE *fp,MYLDAP_ENTRY *entry, log_log(LOG_WARNING,"service entry %s contains multiple %s values", myldap_get_dn(entry),attmap_service_ipServicePort); } + errno=0; port=(int)strtol(ports[0],&tmp,0); if ((*(ports[0])=='\0')||(*tmp!='\0')) { @@ -179,6 +180,12 @@ static int write_service(TFILE *fp,MYLDAP_ENTRY *entry, myldap_get_dn(entry),attmap_service_ipServicePort); return 0; } + else if (errno!=0) + { + log_log(LOG_WARNING,"service entry %s contains too large %s value", + myldap_get_dn(entry),attmap_service_ipServicePort); + return 0; + } /* get protocols */ protocols=myldap_get_values(entry,attmap_service_ipServiceProtocol); if ((protocols==NULL)||(protocols[0]==NULL)) |