Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nslcd/rpc.c
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2012-05-20 21:53:56 +0200
committerArthur de Jong <arthur@arthurdejong.org>2012-05-20 21:53:56 +0200
commit2162182c3ec6e0b31ea88f4ec4843ed986ea9b7a (patch)
treed1d59aefedd79828bed75030f604bd39db0527dc /nslcd/rpc.c
parentc23fb324eae950a912d39a0bb1287efa9b444329 (diff)
implement extra range checking of all numeric values
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1694 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd/rpc.c')
-rw-r--r--nslcd/rpc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/nslcd/rpc.c b/nslcd/rpc.c
index e8691c6..3456612 100644
--- a/nslcd/rpc.c
+++ b/nslcd/rpc.c
@@ -5,7 +5,7 @@
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
- Copyright (C) 2006, 2007, 2009, 2010, 2011 Arthur de Jong
+ Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 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
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdint.h>
#include "common.h"
#include "log.h"
@@ -108,7 +109,7 @@ static int write_rpc(TFILE *fp,MYLDAP_ENTRY *entry,const char *reqname)
const char **aliases;
const char **numbers;
char *tmp;
- int number;
+ long number;
int i;
/* get the most canonical name */
name=myldap_get_rdn_value(entry,attmap_rpc_cn);
@@ -145,16 +146,16 @@ static int write_rpc(TFILE *fp,MYLDAP_ENTRY *entry,const char *reqname)
myldap_get_dn(entry),attmap_rpc_oncRpcNumber);
}
errno=0;
- number=(int)strtol(numbers[0],&tmp,10);
+ number=strtol(numbers[0],&tmp,10);
if ((*(numbers[0])=='\0')||(*tmp!='\0'))
{
log_log(LOG_WARNING,"%s: %s: non-numeric",
myldap_get_dn(entry),attmap_rpc_oncRpcNumber);
return 0;
}
- else if (errno!=0)
+ else if ((errno!=0)||(number>UINT32_MAX))
{
- log_log(LOG_WARNING,"%s: %s: too large",
+ log_log(LOG_WARNING,"%s: %s: out of range",
myldap_get_dn(entry),attmap_rpc_oncRpcNumber);
return 0;
}