032-CVE-2018-1050-v3-6.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From 6cc45e3452194f312e04109cfdae047eb0719c7c Mon Sep 17 00:00:00 2001
  2. From: Jeremy Allison <jra@samba.org>
  3. Date: Tue, 2 Jan 2018 15:56:03 -0800
  4. Subject: [PATCH] CVE-2018-1050: s3: RPC: spoolss server. Protect against null
  5. pointer derefs.
  6. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11343
  7. Signed-off-by: Jeremy Allison <jra@samba.org>
  8. ---
  9. source3/rpc_server/spoolss/srv_spoolss_nt.c | 13 +++++++++++++
  10. 1 file changed, 13 insertions(+)
  11. --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
  12. +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
  13. @@ -176,6 +176,11 @@ static void prune_printername_cache(void
  14. static const char *canon_servername(const char *servername)
  15. {
  16. const char *pservername = servername;
  17. +
  18. + if (servername == NULL) {
  19. + return "";
  20. + }
  21. +
  22. while (*pservername == '\\') {
  23. pservername++;
  24. }
  25. @@ -2080,6 +2085,10 @@ WERROR _spoolss_DeletePrinterDriver(stru
  26. return WERR_ACCESS_DENIED;
  27. }
  28. + if (r->in.architecture == NULL || r->in.driver == NULL) {
  29. + return WERR_INVALID_ENVIRONMENT;
  30. + }
  31. +
  32. /* check that we have a valid driver name first */
  33. if ((version = get_version_id(r->in.architecture)) == -1)
  34. @@ -2225,6 +2234,10 @@ WERROR _spoolss_DeletePrinterDriverEx(st
  35. return WERR_ACCESS_DENIED;
  36. }
  37. + if (r->in.architecture == NULL || r->in.driver == NULL) {
  38. + return WERR_INVALID_ENVIRONMENT;
  39. + }
  40. +
  41. /* check that we have a valid driver name first */
  42. if (get_version_id(r->in.architecture) == -1) {
  43. /* this is what NT returns */